27 # ifndef TPL_COMPONENTS_H 28 # define TPL_COMPONENTS_H 30 # include <tpl_agraph.H> 45 template <
class GT,
class SA = Dft_Show_Arc<GT> >
49 const GT * gptr =
nullptr;
55 noexcept(std::is_nothrow_move_assignable<SA>::value)
60 void build_subgraph(GT & sg,
typename GT::Node * g_src)
65 NODE_BITS(g_src).set_bit(Build_Subtree,
true);
68 auto sg_src = mapped_node <GT> (g_src);
69 if (sg_src ==
nullptr)
71 sg_src = sg.insert_node(g_src->get_info());
76 i.has_curr(); i.next_ne())
78 auto arc = i.get_current_arc_ne();
82 ARC_BITS(arc).set_bit(Build_Subtree,
true);
84 auto g_tgt = i.get_tgt_node();
85 auto sg_tgt = mapped_node <GT> (g_tgt);
86 if (sg_tgt ==
nullptr)
88 sg_tgt = sg.insert_node(g_tgt->get_info());
93 auto sg_arc = sg.insert_arc(sg_src, sg_tgt, arc->get_info());
97 build_subgraph(sg, g_tgt);
101 template <
template <
class>
class List>
102 void build_subgraph(List<typename GT::Node*> & l,
typename GT::Node * p)
107 NODE_BITS(p).set_bit(Build_Subtree,
true);
112 count < gptr->get_num_nodes() and it.has_curr(); it.next_ne())
114 auto arc = it.get_current_arc_ne();
118 ARC_BITS(arc).set_bit(Build_Subtree,
true);
119 build_subgraph(l, it.get_tgt_node());
141 void operator () (
const GT & g, GT & sg,
typename GT::Node * g_src)
145 build_subgraph (sg, g_src);
148 GT
operator () (
const GT & g,
typename GT::Node * src)
153 build_subgraph(sg, src);
173 typename GT::Node * src)
177 build_subgraph<DynList>(list, src);
206 template <
class GT,
class SA = Dft_Show_Arc<GT> >
214 noexcept(std::is_nothrow_move_assignable<SA>::value)
217 template <
template <
class>
class List>
218 void compute_blocks(
const GT & g, List <GT> &
list)
223 for (
typename GT::Node_Iterator it(g);
224 count < g.get_num_nodes() and it.has_curr(); it.next_ne())
226 auto curr = it.get_current_node_ne();
230 GT & subgraph = list.append(GT());
233 build(g, subgraph, curr);
235 count += subgraph.get_num_nodes();
239 template <
template <
class>
class List>
240 void compute_lists(
const GT & g, List<List<typename GT::Node*> > & list)
245 for (
typename GT::Node_Iterator i(g);
246 count < g.get_num_nodes() and i.has_curr(); i.next_ne())
248 auto curr = i.get_current_node_ne();
253 auto & l = list.append(List<typename GT::Node*>());
278 compute_blocks<DynList>(g, list);
297 compute_lists<DynList>(g, list);
304 # endif // TPL_COMPONENTS_H #define IS_NODE_VISITED(p, bit)
Definition: aleph-graph.H:327
void map_arcs(typename GTS::Arc *p, typename GTT::Arc *q) noexcept
Definition: tpl_graph.H:3445
Definition: tpl_components.H:46
#define IS_ARC_VISITED(p, bit)
Definition: aleph-graph.H:360
void map_nodes(typename GTS::Node *p, typename GTT::Node *q) noexcept
Definition: tpl_graph.H:3419
#define NODE_BITS(p)
Definition: aleph-graph.H:305
#define ARC_BITS(p)
Definition: aleph-graph.H:351
Definition: tpl_components.H:207
Definition: tpl_graph.H:1177
void operator()(const GT &g, GT &sg, typename GT::Node *g_src)
Definition: tpl_components.H:141