51# ifndef TPL_COMPONENTS_H
52# define TPL_COMPONENTS_H
101template <
class GT,
class SA = Dft_Show_Arc<GT>>
141 auto arc = i.get_current_arc_ne();
149 auto g_tgt = i.get_tgt_node();
167 template <
template <
class>
class List>
182 auto arc = it.get_current_arc_ne();
212 <<
"Build_Subgraph: source node cannot be null";
232 <<
"Build_Subgraph: source node cannot be null";
258 <<
"Build_Subgraph: source node cannot be null";
313template <
class GT,
class SA = Dft_Show_Arc<GT>>
336 template <
template <
class>
class List>
343 for (
typename GT::Node_Iterator it(g);
346 auto curr = it.get_current_node_ne();
368 template <
template <
class>
class List>
375 for (
typename GT::Node_Iterator i(g);
378 auto curr = i.get_current_node_ne();
Exception handling system with formatted messages for Aleph-w.
#define ah_invalid_argument_if(C)
Throws std::invalid_argument if condition holds.
Build a mapped subgraph from a graph starting at a given node.
void operator()(const GT &g, GT &sg, typename GT::Node *g_src)
Build a mapped subgraph starting from a specific node.
void build_subgraph(List< typename GT::Node * > &l, typename GT::Node *p)
void build_subgraph(GT &sg, typename GT::Node *g_src)
Build_Subgraph(SA arc_filter=SA())
Construct a subgraph builder with optional arc filter.
Dynamic singly linked list with functional programming support.
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).
size_t size() const noexcept
Count the number of elements of the list.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Compute the connected components of a graph.
void compute_blocks(const GT &g, List< GT > &list)
Compute connected components as mapped subgraphs.
Unconnected_Components(SA arc_filter=SA())
Construct a component finder with optional arc filter.
void compute_lists(const GT &g, List< List< typename GT::Node * > > &list)
Compute connected components as lists of node pointers.
void operator()(const GT &g, DynList< GT > &list)
Compute connected components as mapped subgraphs.
size_t count_components(const GT &g)
Count the number of connected components in a graph.
bool is_connected(const GT &g)
Check if a graph is connected.
void reset_arcs() const
Reset all the arcs of graph (the control bits, the state, the counter and the cookie)
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)
static void map_nodes(N1 *p, N2 *q) noexcept
Map the nodes through their cookies.
List_Graph< Graph_Node< int >, Graph_Arc< int > > GT
#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.
#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.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
Filtered iterator of adjacent arcs of a node.
Array-based graph implementation.