32#include <gtest/gtest.h>
94 for (
int i = 0; i <
k; ++i)
101 for (
int i = 0; i <
k; ++i)
102 for (
int j = i + 1; j <
k; ++j)
106 for (
int i = 0; i <
k; ++i)
107 for (
int j = i + 1; j <
k; ++j)
123 for (
int i = 0; i < n; ++i)
126 for (
int i = 0; i < n - 1; ++i)
139 for (
int i = 0; i < n; ++i)
142 for (
int i = 0; i < n; ++i)
150IntGraph create_complete_graph(
int n)
155 for (
int i = 0; i < n; ++i)
158 for (
int i = 0; i < n; ++i)
159 for (
int j = i + 1; j < n; ++j)
172 for (
int i = 1; i < n; ++i)
242 using Distance_Type =
int;
341 auto g = create_square();
418 auto g = create_complete_graph(3);
432 auto g = create_complete_graph(4);
446 auto g = create_complete_graph(5);
460 auto g = create_complete_graph(6);
589 auto g = create_complete_graph(5);
612 for (
auto it = vs.
get_it(); it.has_curr(); it.next())
615 for (
auto it =
vt.
get_it(); it.has_curr(); it.next())
630 for (
auto it = vs.
get_it(); it.has_curr(); it.next())
632 for (
auto it =
vt.
get_it(); it.has_curr(); it.next())
635 for (
auto it = cut.
get_it(); it.has_curr(); it.next())
637 auto arc = it.get_curr();
638 auto src = g.get_src_node(arc);
639 auto tgt = g.get_tgt_node(arc);
656 int weight =
sw.min_cut_weight(g);
666 int weight =
sw.min_cut_weight(g);
673 auto g = create_complete_graph(6);
693 int weight =
sw.min_cut_weight(g);
725 auto g = create_complete_graph(5);
745 using Distance_Type =
int;
765 using Distance_Type =
int;
906 auto g = create_complete_graph(4);
947 for (
int i = 0; i <
N; ++i)
951 for (
int i = 0; i <
N - 1; ++i)
955 for (
int i = 0; i <
N; i += 5)
956 for (
int j = i + 10; j <
N; j += 10)
970 auto g = create_complete_graph(20);
988 auto g = create_complete_graph(8);
Stoer-Wagner deterministic min-cut algorithm.
Graph create_triangle()
Creates a triangle (K_3) - the simplest non-bipartite graph.
Dynamic singly linked list with functional programming support.
T & insert(const T &item)
Insert a new item by copy.
Dynamic set backed by balanced binary search trees with automatic memory management.
Arc for graphs implemented with simple adjacency lists.
constexpr bool is_empty() const noexcept
Return true if list is empty.
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)
Graph class implemented with singly-linked adjacency lists.
Arc * insert_arc(Node *src, Node *tgt, void *a)
virtual Node * insert_node(Node *p)
Insertion of a node whose memory has already been allocated.
Stoer-Wagner deterministic minimum cut algorithm.
ArcInfo & get_info() noexcept
Return a modifiable reference to the arc data.
auto get_it() const
Return a properly initialized iterator positioned at the first item on the container.
DynArray< Graph::Node * > nodes
Main namespace for Aleph-w library functions.
Container2< typename Container1::Item_Type > filter(Container1 &container, Operation &operation)
Filter elements that satisfy operation.
@ Cycle
Graph has an Eulerian cycle.
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.
Arc of graph implemented with double-linked adjacency lists.
Distance_Type operator()(SimpleGraph::Arc *arc) const
bool operator()(typename GT::Arc *a) const
GT create_cycle(size_t n)
Generic graph and digraph implementations.
Simple graph implementation with adjacency lists.