81 for (
auto it = g.
get_out_it(p); it.has_curr(); it.next_ne())
83 auto a = it.get_current_arc_ne();
125 for (
auto it = g.
get_out_it(p); it.has_curr(); it.next_ne())
127 auto a = it.get_current_arc_ne();
160 for (
auto it = g.
get_out_it(p); it.has_curr(); it.next_ne())
162 auto a = it.get_current_arc_ne();
220 for (
auto it = g.
get_node_it(); it.has_curr(); it.next_ne())
228 for (
long i =
static_cast<long>(
df.size()) - 1,
color = 0; i >= 0; --i)
230 auto gp =
df.access(i);
244 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
246 auto a = it.get_curr();
309 for (
auto it = g.
get_node_it(); it.has_curr(); it.next_ne())
315 for (
long i =
static_cast<long>(
df.size()) - 1; i >= 0; --i)
317 auto gp =
df.access(i);
T & access(const size_t i) const noexcept
Fast access without checking allocation and bound_min_clock checking.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
Append a new item by copy.
NodeInfo & get_info() noexcept
Return a modifiable reference to the data contained in the node.
void reset_arcs() const
Reset all the arcs of graph (the control bits, the state, the counter and the cookie)
auto get_arc_it() const noexcept
Obtains an iterator to the arc of graph.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Out_Iterator get_out_it(Node *p) const noexcept
Return an output iterator on the incoming nodes to p
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
static void map_arcs(A1 *p, A2 *q) noexcept
Map the arcs through their cookies.
void reset_nodes() const
Reset all the nodes of graph (the control bits, the state, the counter and the cookie)
auto get_node_it() const noexcept
Obtains an iterator to the nodes of graph.
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
static void map_nodes(N1 *p, N2 *q) noexcept
Map the nodes through their cookies.
List_Graph< Graph_Node< int >, Graph_Arc< int > > GT
void kosaraju_connected_components(const GT &g, DynList< GT > &blk_list, DynList< typename GT::Arc * > &arc_list)
Compute strongly connected components using Kosaraju's algorithm.
#define NODE_COUNTER(p)
Get the counter of a node.
#define IS_NODE_VISITED(p, bit)
Determine whether the control bit is set or not to one.
GT invert_digraph(const GT &g)
Compute the transpose (arc-reversed) digraph.
#define ARC_BITS(p)
Return the control bits of arc p.
size_t kosaraju_scc_count(const GT &g)
Count the number of strongly connected components.
#define NODE_COLOR(p)
Synonymous of NODE_COUNTER.
#define IS_ARC_VISITED(p, bit)
Determine whether the bit field is or not set to one.
bool is_strongly_connected(const GT &g)
Check if a directed graph is strongly connected.
#define NODE_BITS(p)
Get the control bits of a node.
Main namespace for Aleph-w library functions.
static void __dfp_phase1(const GT &g, typename GT::Node *p, DynArray< typename GT::Node * > &df)
Depth-first search that computes finish times in postorder (Phase 1).
static void __dfp_phase2_subgraph(const GT &g, typename GT::Node *p, GT &blk, const int &color)
DFS on transposed graph that builds an SCC subgraph (Phase 2).
static long & df(typename GT::Node *p)
Internal helper: DFS discovery time stored in NODE_COUNTER(p).
static void __dfp_phase2_list(const GT &g, typename GT::Node *p, DynList< typename GT::Node * > &list)
DFS on transposed graph that builds an SCC node list (Phase 2).
static long & color(typename GT::Node *p)
DynList< T > maps(const C &c, Op op)
Classic map operation.
Arc of graph implemented with double-linked adjacency lists.
Functor wrapper for Kosaraju's algorithm.
void operator()(const GT &g, DynList< GT > &blk_list, DynList< typename GT::Arc * > &arc_list) const
Compute SCCs returning subgraphs and cross-arcs.
Utility algorithms and operations for graphs.