112 return tree.are_connected(i, j);
138 template <
class G,
class GT_SA>
183 it.has_curr(); it.next_ne())
185 auto arc = it.get_current_arc_ne();
214 for (
typename GT::Node_Iterator it(g); it.has_curr(); it.next_ne())
216 auto gp = it.get_curr();
224 auto ga = it.get_current_arc_ne();
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
Standard functor implementations and comparison objects.
Default distance accessor for arc weights.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
Computes the minimum spanning tree of a graph using Kruskal's algorithm.
bool is_painted() const noexcept
Returns true if the spanning tree has been painted on the graph.
void paint_min_spanning_tree(const GT &g)
Paints the minimum spanning tree arcs on the graph.
Kruskal_Min_Spanning_Tree(Distance __dist=Distance(), SA __sa=SA())
Constructor.
void paint_min_spanning_tree(const GT &g, GT &tree)
Paints the MST on g and copies it to a separate tree graph.
static bool arc_is_in_tree(Fixed_Relation &tree, long i, long j) noexcept
void operator()(const GT &g, GT &tree)
Computes the minimum spanning tree using Kruskal's algorithm.
Kruskal_Min_Spanning_Tree(Distance &__dist, SA __sa=SA())
Constructor with reference to external distance accessor.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Binary relation between a set of integers.
constexpr size_t get_num_blocks() const noexcept
Return the number of connected blocks, which is the number of equivalence classes.
void join(size_t i, size_t j)
Insert the pair '(i,j)' in the relation.
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.
bool is_digraph() const noexcept
Return true if the graph this is directed.
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.
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
#define NODE_COUNTER(p)
Get the counter of a node.
#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.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Filtered iterator on all the arcs of a graph.
Default filter for filtered iterators on arcs.
Comparison functor for arc weights/distances.
Helper struct for initializing node counters during DFS.
void operator()(const GT &, typename GT::Node *p) noexcept
Filter for arcs painted by Kruskal's algorithm.
bool operator()(typename G::Arc *a) const noexcept
Array-based graph implementation.
Utility algorithms and operations for graphs.
DAG (acyclic) graph testing.
Union-Find (Disjoint Set Union) data structure.