51# ifndef TPL_CUT_NODES_H
52# define TPL_CUT_NODES_H
114 template <
class GT,
class SA = Dft_Show_Arc<GT>>
134 auto arc = i.get_curr();
138 auto tgt = i.get_tgt_node();
203 auto tgt = it.get_tgt_node();
207 auto arc = it.get_curr();
237 auto arc = it.get_curr();
241 auto tgt = it.get_tgt_node();
257 auto arc = it.get_curr();
261 auto tgt_node = it.get_tgt_node();
308 auto garc = i.get_curr();
314 auto gtgt = i.get_tgt_node();
389 <<
"Cut nodes have not been computed or the class is in another phase";
423 for (
typename GT::Node_Iterator it(*
gptr); it.has_curr(); it.next_ne())
425 first = it.get_curr();
427 if (first ==
nullptr)
471 auto gp = it.get_curr();
485 auto garc = it.get_curr();
498 assert(src !=
nullptr and tgt !=
nullptr);
528 <<
"Cut nodes have not been computed";
544 for (
typename GT::Node_Iterator it(*
gptr); it.has_curr(); it.next_ne())
546 auto p = it.get_curr();
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
#define ah_logic_error_if(C)
Throws std::logic_error if condition holds.
Computation of cut nodes (articulation points) of a graph.
void map_cut_graph(GT &cut_graph, DynDlist< typename GT::Arc * > &cross_arc_list)
Computes the mapped cut graph of a graph.
void map_subgraph(GT &sg, typename GT::Node *gsrc, const long &color)
GT::Node * create_and_map_node(typename GT::Node *gp, const long &color, GT &sg)
enum Aleph::Compute_Cut_Nodes::State state
void map_subgraph(GT &sg, const long &color)
Obtains a mapped copy of the component with the given color.
void operator()(DynDlist< typename GT::Node * > &list)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void paint_subgraph(typename GT::Node *p)
DynDlist< typename GT::Node * > * list_ptr
Compute_Cut_Nodes(const GT &g, SA __sa=SA())
Constructor for cut nodes calculator.
void compute_blocks(DynDlist< GT > &block_list, GT &cut_graph, DynDlist< typename GT::Arc * > &cross_arc_list)
Build mapped graphs around cut nodes.
void cut_nodes(typename GT::Node *start, DynDlist< typename GT::Node * > &list)
Computes the cut nodes.
long paint_subgraphs()
Paints the connected components around the cut nodes.
void cut_nodes(typename GT::Node *p, typename GT::Arc *a)
void paint_from_cut_node(typename GT::Node *p)
bool has_curr() const noexcept
Return true if the iterator has current item.
T & access(const size_t i) const noexcept
Fast access without checking allocation and bound_min_clock checking.
void reserve(const size_t l, const size_t r)
Allocate a range of entries.
Dynamic doubly linked list with O(1) size and bidirectional access.
void empty() noexcept
Empty the list.
T & append(const T &item)
Append a copied item at the end of the list.
T & append(const T &item)
Append a new item by copy.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
Node * get_first_node() const
Return any node in the graph.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
void reset_arcs() const
Reset all the arcs of graph (the control bits, the state, the counter and the cookie)
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
static void map_arcs(A1 *p, A2 *q) noexcept
Map the arcs through their cookies.
void reset_counter_nodes() const noexcept
Reset all the counters to zero for all the nodes of graph.
void reset_counter_arcs() const noexcept
Reset all the counters to zero for all the arcs 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.
void for_each_node(Operation &operation) const
Unconditionally traverse all the nodes of graph and on each one perform an operation.
List_Graph< Graph_Node< int >, Graph_Arc< int > > GT
#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.
#define ARC_BITS(p)
Return the control bits of arc p.
void clear_graph(GT &g) noexcept
Clean a graph: all its nodes and arcs are removed and freed.
#define IS_ARC_VISITED(p, bit)
Determine whether the bit field is or not set to one.
#define NODE_BITS(p)
Get the control bits of a node.
Main namespace for Aleph-w library functions.
const long Cross_Arc
Special marker for arcs connecting a cut node to a non-cut block.
static long & color(typename GT::Node *p)
DynList< T > maps(const C &c, Op op)
Classic map operation.
Filtered iterator on all the arcs of a graph.
Arc of graph implemented with double-linked adjacency lists.
Filtered iterator of adjacent arcs of a node.
Utility algorithms and operations for graphs.