1 # ifndef TPL_COMPONENTS_H
2 # define TPL_COMPONENTS_H
19 template <
class GT,
class SA = Dft_Show_Arc<GT> >
34 void build_subgraph(GT & sg,
typename GT::Node * g_src)
39 NODE_BITS(g_src).set_bit(Build_Subtree,
true);
42 typename GT::Node * sg_src = mapped_node <GT> (g_src);
45 sg_src = sg.insert_node(g_src->get_info());
46 GT::map_nodes(g_src, sg_src);
50 count < gptr->get_num_nodes() and i.has_current(); i.next())
52 typename GT::Arc * arc = i.get_current_arc();
56 ARC_BITS(arc).set_bit(Build_Subtree,
true);
58 typename GT::Node * g_tgt = i.get_tgt_node();
59 typename GT::Node * sg_tgt = mapped_node <GT> (g_tgt);
63 sg_tgt = sg.insert_node(g_tgt->get_info());
64 GT::map_nodes(g_tgt, sg_tgt);
68 typename GT::Arc * sg_arc =
69 sg.insert_arc(sg_src, sg_tgt, arc->get_info());
71 GT::map_arcs(arc, sg_arc);
73 build_subgraph(sg, g_tgt);
77 template <
template <
class>
class List>
78 void build_subgraph(List<typename GT::Node*> & l,
typename GT::Node * p)
83 NODE_BITS(p).set_bit(Build_Subtree,
true);
88 count < gptr->get_num_nodes() and it.has_curr(); it.next())
90 typename GT::Arc * arc = it.get_current_arc();
94 ARC_BITS(arc).set_bit(Build_Subtree,
true);
96 build_subgraph(l, it.get_tgt_node());
122 build_subgraph (sg, g_src);
141 typename GT::Node * src)
145 build_subgraph<DynDlist>(list, src);
164 typename GT::Node * src)
168 build_subgraph<DynList>(list, src);
197 template <
class GT,
class SA = Dft_Show_Arc<GT> >
209 template <
template <
class>
class List>
210 void compute_blocks(GT & g, List <GT> &
list)
215 for (
typename GT::Node_Iterator it(g);
216 count < g.get_num_nodes() and it.has_curr(); it.next())
218 typename GT::Node * curr = it.get_current_node();
222 GT & subgraph = list.append(GT());
225 build(g, subgraph, curr);
227 count += subgraph.get_num_nodes();
231 template <
template <
class>
class List>
232 void compute_lists(GT & g, List<List<typename GT::Node*> > & list)
237 for (
typename GT::Node_Iterator i(g);
238 count < g.get_num_nodes() and i.has_curr(); i.next())
240 typename GT::Node * curr = i.get_current_node();
245 List<typename GT::Node*> & l =
246 list.append(List<typename GT::Node*>());
257 compute_blocks<DynDlist>(g, list);
262 compute_lists<DynDlist>(g, list);
281 compute_blocks<DynList>(g, list);
300 compute_lists<DynList>(g, list);
307 # endif // TPL_COMPONENTS_H
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Definition: ahAlgo.H:127
#define IS_NODE_VISITED(p, bit)
Definition: aleph-graph.H:242
void operator()(GT &g, GT &sg, typename GT::Node *g_src)
Definition: tpl_components.H:118
Definition: tpl_components.H:20
#define IS_ARC_VISITED(p, bit)
Definition: aleph-graph.H:275
#define NODE_BITS(p)
Definition: aleph-graph.H:221
#define ARC_BITS(p)
Definition: aleph-graph.H:266
Definition: tpl_components.H:198
Definition: tpl_graph.H:694