4 # include <tpl_graph_utils.H>
8 template <
class GT,
class SA>
inline static
19 typename GT::Arc * a = it.get_current_arc();
23 ARC_BITS(a).set_bit(Depth_First,
true);
25 __dfp<GT,SA>(g, it.get_tgt_node(), df);
35 template <
class GT,
class SA>
inline static
36 void __dfp(GT & g,
typename GT::Node * p, GT & blk,
const int & color)
43 typename GT::Node * q = blk.insert_node(p->get_info());
49 typename GT::Arc * a = it.get_current_arc();
53 ARC_BITS(a).set_bit(Depth_First,
true);
55 __dfp<GT,SA>(g, it.get_tgt_node(), blk, color);
92 template <
class GT,
class SA>
inline
105 __dfp<GT,SA>(g, it.get_current(), df);
108 invert_digraph<GT,SA>(g, gi);
112 for (
int i = df.
size() - 1, color = 0; i >= 0; i--)
114 typename GT::Node * gp = df.
access(i);
115 typename GT::Node * bp = mapped_node<GT>(gp);
120 GT & blk = blk_list.
append(GT());
123 __dfp<GT,SA>(gi, bp, blk, color++);
125 I(
NODE_COLOR(mapped_node<GT>(bp)) == color - 1);
131 typename GT::Arc * a = it.get_current();
132 typename GT::Node * gs = g.get_src_node(a);
133 typename GT::Node * gt = g.get_tgt_node(a);
135 typename GT::Node * bs = mapped_node<GT>(mapped_node<GT>(gs));
136 typename GT::Node * bt = mapped_node<GT>(mapped_node<GT>(gt));
142 typename GT::Arc * ba = array.access(color)->insert_arc(bs, bt);
151 template <
class GT>
inline
156 kosaraju_connected_components<GT,Dft_Show_Arc<GT> >
157 (g, blk_list, arc_list);
165 template <
class GT,
class SA>
inline static
173 list.
append(mapped_node<GT>(p));
177 typename GT::Arc * a = it.get_current_arc();
181 ARC_BITS(a).set_bit(Depth_First,
true);
183 __dfp<GT,SA>(g, it.get_tgt_node(), list);
225 template <
class GT,
class SA>
inline
236 __dfp<GT,SA>(g, it.get_current(), df);
239 invert_digraph<GT,SA>(g, gi);
241 for (
int i = df.
size() - 1; i >= 0; i--)
243 typename GT::Node * gp = df.
access(i);
244 typename GT::Node * bp = mapped_node<GT>(gp);
251 __dfp<GT,SA>(gi, bp, blk);
256 template <
class GT>
inline
261 kosaraju_connected_components<GT,Dft_Show_Arc<GT> > (g, list);
292 template <
class GT,
class SA = Dft_Show_Arc<GT> >
309 kosaraju_connected_components<GT, SA> (g, blk_list, arc_list);
321 kosaraju_connected_components<GT, SA> (g, list);
327 # endif // KOSARAJU_H
Definition: kosaraju.H:293
size_t size() const
Retorna dimensión actual (más lejano índice escrito)
Definition: tpl_dynArray.H:523
Definition: tpl_dynDlist.H:26
Definition: tpl_graph.H:751
#define IS_NODE_VISITED(p, bit)
Definition: aleph-graph.H:242
#define NODE_COUNTER(p)
Definition: aleph-graph.H:226
#define IS_ARC_VISITED(p, bit)
Definition: aleph-graph.H:275
void kosaraju_connected_components(GT &g, DynDlist< DynDlist< typename GT::Node * > > &list)
Definition: kosaraju.H:226
void next()
Adelanta el iterador una posición.
Definition: filter_iterator.H:143
#define NODE_BITS(p)
Definition: aleph-graph.H:221
T & append()
Definition: tpl_dynArray.H:1115
Definition: tpl_graph.H:814
#define ARC_BITS(p)
Definition: aleph-graph.H:266
#define NODE_COLOR(p)
Definition: aleph-graph.H:232
T & access(const size_t i)
Definition: tpl_dynArray.H:793
void operator()(GT &g, DynDlist< GT > &blk_list, DynDlist< typename GT::Arc * > &arc_list)
Definition: kosaraju.H:305
Definition: tpl_graph.H:694
T & append(const T &item)
Definition: tpl_dynDlist.H:106