43#include <gtest/gtest.h>
58 std::vector<Graph::Node *> make_nodes(
Graph &g,
int n)
60 std::vector<Graph::Node *>
nodes;
62 for (
int i = 0; i < n; ++i)
73 for (
size_t i = 0; i < n; ++i)
79 for (
size_t i = 0; i <
nodes.size(); ++i)
80 for (
size_t j = i + 1; j <
nodes.size(); ++j)
90 if (it.get_curr() == arc)
106 auto node = it.get_curr();
107 const bool in_l =
l.contains(node);
114 auto arc = it.get_curr();
126 auto arc = it.get_curr();
156 auto nodes = make_nodes(g, 2);
165 auto nodes = make_nodes(g, 4);
175 auto nodes = make_nodes(g, 4);
184 auto nodes = make_nodes(g, 4);
193 auto nodes = make_nodes(g, 2);
228 auto nodes = make_nodes(g, 2);
242 auto nodes = make_nodes(g, 4);
257 auto nodes = make_nodes(g, 4);
271 auto nodes = make_nodes(g, 2);
301 auto nodes = make_nodes(g, 2);
310 auto nodes = make_nodes(g, 4);
320 auto nodes = make_nodes(g, 4);
329 auto nodes = make_nodes(g, 4);
338 auto nodes = make_nodes(g, 5);
353 auto n1 = g.insert_node(1);
354 auto n2 = g.insert_node(2);
355 g.insert_arc(n1, n2);
Generic directed graph (digraph) wrapper template.
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic doubly linked list with O(1) size and bidirectional access.
const size_t & size() const noexcept
Return the number of elements (constant time)
Dynamic set backed by balanced binary search trees with automatic memory management.
const size_t & size() const
Returns the cardinality of the set.
bool contains(const Key &key) const
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)
Filtered iterator on the nodes of a graph.
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.
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
List_Digraph< IntNode, DoubleArc > TestDigraph
DynArray< Graph::Node * > nodes
Main namespace for Aleph-w library functions.
Net::Flow_Type min_cut(Net &net, DynSetTree< typename Net::Node * > &vs, DynSetTree< typename Net::Node * > &vt, DynList< typename Net::Arc * > &cuts, DynList< typename Net::Arc * > &cutt)
Compute max flow and the corresponding minimum cut.
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.
Generic graph and digraph implementations.
K-connected graph structures and connectivity algorithms.