52# ifndef TPL_SPANNING_TREE_H
53# define TPL_SPANNING_TREE_H
112template <AlephGraph GT, ArcFilter<GT> SA = Dft_Show_Arc<GT>>
149 auto arc = i.get_current_arc_ne();
189 auto arc = i.get_current_arc_ne();
234 <<
"Find_Depth_First_Spanning_Tree: graph is empty";
263 <<
"Find_Depth_First_Spanning_Tree: source node cannot be null";
315template <AlephGraph GT, ArcFilter<GT> SA = Dft_Show_Arc<GT>>
337 q.
put(i.get_current_arc_ne());
377 auto current_arc = i.get_current_arc_ne();
419 <<
"Find_Breadth_First_Spanning_Tree: source node cannot be null";
439 <<
"Find_Breadth_First_Spanning_Tree: graph is empty";
466template <AlephGraph GT>
498 <<
"Build_Spanning_Tree: arcs array cannot be null";
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
#define ah_invalid_argument_if(C)
Throws std::invalid_argument if condition holds.
C++20 concepts for the protocol shared by graph algorithms.
EepicNode< long > * build_tree()
Build a spanning tree from an array of arcs.
GT operator()(const DynArray< typename GT::Arc * > &arcs) const
Construct spanning tree from array of arc pointers.
Dynamic queue of elements of generic type T based on single linked list.
T & put(const T &data)
The type of element.
T get()
Remove the oldest item of the queue.
bool is_empty() const noexcept
Return true if this is empty.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
Compute a breadth-first spanning tree of a graph.
void build_tree(GT &g, typename GT::Node *gp, GT &tree)
void operator()(GT &g, typename GT::Node *gnode, GT &tree)
Build a breadth-first spanning tree starting from a specific node.
Find_Breadth_First_Spanning_Tree(SA arc_filter=SA())
Construct a BFS spanning tree builder with optional arc filter.
Compute a depth-first spanning tree of a graph.
GT::Node * operator()(GT &g, GT &tree)
Build a depth-first spanning tree starting from the first node.
Find_Depth_First_Spanning_Tree(SA arc_filter=SA())
Construct a DFS spanning tree builder with optional arc filter.
bool build_tree(typename GT::Node *gnode, typename GT::Arc *garc, typename GT::Node *tnode)
bool build_tree(GT &g, typename GT::Node *gnode, GT &tree)
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_bit_nodes(int bit) const noexcept
Reset bit to zero for all the nodes of graph.
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)
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_bit_arcs(int bit) const noexcept
Reset bit to zero for all the arcs of graph.
constexpr size_t get_num_arcs() const noexcept
void reset_nodes() const
Reset all the nodes of graph (the control bits, the state, the counter and the cookie)
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.
DynArray< Graph::Arc * > arcs
#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 NODE_COOKIE(p)
Return the node cookie
void clear_graph(GT &g) noexcept
Clean a graph: all its nodes and arcs are removed and freed.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
#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.
and
Check uniqueness with explicit hash + equality functors.
Filtered iterator of adjacent arcs of a node.
Generic graph and digraph implementations.
Utility algorithms and operations for graphs.