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;
282 int min_cut = sw(g, vs, vt, cut);
297 int min_cut = sw(g, vs, vt, cut);
316 int min_cut = sw(g, vs, vt, cut);
332 int min_cut = sw(g, vs, vt, cut);
341 auto g = create_square();
347 int min_cut = sw(g, vs, vt, cut);
361 int min_cut = sw(g, vs, vt, cut);
376 int min_cut = sw(g, vs, vt, cut);
391 int min_cut = sw(g, vs, vt, cut);
406 int min_cut = sw(g, vs, vt, cut);
418 auto g = create_complete_graph(3);
424 int min_cut = sw(g, vs, vt, cut);
432 auto g = create_complete_graph(4);
438 int min_cut = sw(g, vs, vt, cut);
446 auto g = create_complete_graph(5);
452 int min_cut = sw(g, vs, vt, cut);
460 auto g = create_complete_graph(6);
466 int min_cut = sw(g, vs, vt, cut);
484 int min_cut = sw(g, vs, vt, cut);
498 int min_cut = sw(g, vs, vt, cut);
511 int min_cut = sw(g, vs, vt, cut);
524 int min_cut = sw(g, vs, vt, cut);
539 int min_cut = sw(g, vs, vt, cut);
562 int min_cut = sw(g, vs, vt, cut);
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())
633 vt_set.insert(it.get_curr());
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);
673 auto g = create_complete_graph(6);
717 size_t min_cut = sw(g, vs, vt, cut);
725 auto g = create_complete_graph(5);
731 size_t min_cut = sw(g, vs, vt, cut);
745 using Distance_Type =
int;
755 int min_cut = sw(g, vs, vt, cut);
765 using Distance_Type =
int;
775 int min_cut = sw(g, vs, vt, cut);
820 int min_cut = sw(g, vs, vt, cut);
846 int min_cut = sw(g, vs, vt, cut);
872 double min_cut = sw(g, vs, vt, cut);
898 int min_cut = sw(g, vs, vt, cut);
906 auto g = create_complete_graph(4);
912 int min_cut = sw(g, vs, vt, cut);
932 int min_cut = sw(g, vs, vt, cut);
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);
976 int min_cut = sw(g, vs, vt, cut);
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.
Doubly-linked list (defined in tpl_dynList.H).
Dynamic set backed by balanced binary search trees with automatic memory management.
Key * insert(const Key &key)
Inserts a key into the dynamic set.
Arc for graphs implemented with simple adjacency lists.
constexpr bool is_empty() const noexcept
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.
Weight min_cut_weight(GT &g)
Find only the minimum cut weight (faster, no partition info).
A non-degenerate triangle defined by three points.
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
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
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.
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.