38#include <gtest/gtest.h>
40#include <initializer_list>
56 for (
int i = 0; i < n; ++i)
65 s.
insert(it.get_curr()->get_info());
84 for (
auto it = g.
get_node_it(); it.has_curr(); it.next_ne())
86 auto p = it.get_curr();
96 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
98 auto a = it.get_curr();
108 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
119 auto nodes = make_nodes(g, 4);
134 auto nodes = make_nodes(g, 4);
150 auto nodes = make_nodes(g, 6);
151 const int center = 0;
152 for (
int i = 1; i < 6; ++i)
165 auto nodes = make_nodes(g, 2);
177 auto nodes = make_nodes(g, 5);
178 for (
int i = 1; i < 5; ++i)
190 for (
int i = 1; i < 5; ++i)
208 auto nodes = make_nodes(g, 5);
209 for (
int i = 1; i < 5; ++i)
231 auto nodes = make_nodes(g, 4);
256 auto nodes = make_nodes(g, 4);
258 for (
int i = 0; i < 4; ++i)
259 for (
int j = i + 1; j < 4; ++j)
272 auto nodes = make_nodes(g, 7);
297 auto nodes = make_nodes(g, 6);
317 auto nodes = make_nodes(g, 4);
334 auto nodes = make_nodes(g, 5);
360 auto nodes = make_nodes(g, 3);
374 auto nodes = make_nodes(g, 3);
389 auto nodes = make_nodes(g, 3);
412 auto nodes = make_nodes(g, 3);
436 auto nodes = make_nodes(g, 4);
451 auto nodes = make_nodes(g, 4);
470 auto nodes = make_nodes(g, 5);
472 for (
int i = 1; i < 5; ++i)
487 for (
int i = 1; i < 5; ++i)
499 auto nodes = make_nodes(g, 3);
506 alg.paint_subgraphs();
510 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
520 auto nodes = make_nodes(g, 6);
533 alg.paint_subgraphs();
541 auto nodes = make_nodes(g, 7);
567 auto nodes = make_nodes(g, 3);
573 alg.paint_subgraphs();
582 auto nodes = make_nodes(g, 5);
583 for (
int i = 1; i < 5; ++i)
589 alg.paint_subgraphs();
605 auto nodes = make_nodes(g, 3);
612 alg.paint_subgraphs();
615 alg.map_subgraph(sg, 1L);
618 for (
auto it = sg.
get_node_it(); it.has_curr(); it.next_ne())
633 auto nodes = make_nodes(g, 5);
642 alg.paint_subgraphs();
646 alg.map_cut_graph(
cg, cross);
654 auto nodes = make_nodes(g, 3);
661 alg.paint_subgraphs();
665 alg.map_cut_graph(
cg, cross);
669 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
683 auto nodes = make_nodes(g, 2);
698 auto nodes = make_nodes(g, 5);
699 for (
int i = 1; i < 5; ++i)
718 auto nodes = make_nodes(g, 7);
733 alg.compute_blocks(blocks,
cg, cross);
741 auto nodes = make_nodes(g, 5);
754 alg.compute_blocks(blocks,
cg, cross);
762 auto nodes = make_nodes(g, 3);
773 alg.compute_blocks(blocks,
cg, cross);
785 auto nodes = make_nodes(g, 1);
797 auto nodes = make_nodes(g, 2);
810 auto nodes = make_nodes(g, 3);
825 auto nodes = make_nodes(g, 3);
840 auto nodes = make_nodes(g, 3);
859 auto nodes = make_nodes(g, 5);
860 for (
int i = 1; i < 5; ++i)
890 auto nodes = make_nodes(g, 4);
909 auto nodes = make_nodes(g,
N);
912 for (
int i = 0; i <
N - 1; ++i)
925 auto nodes = make_nodes(g, 3);
931 alg.paint_subgraphs();
937 alg.map_subgraph(sg, 999L);
939 catch (
const std::domain_error &)
967 auto nodes = make_nodes(g, 4);
986 auto nodes = make_nodes(g, 4);
1000 auto nodes = make_nodes(g, 6);
1024 auto nodes = make_nodes(g, 5);
1042 auto nodes = make_nodes(g, 4);
1043 for (
int i = 0; i < 4; ++i)
1044 for (
int j = i + 1; j < 4; ++j)
1054 auto nodes = make_nodes(g, 1);
1062 auto nodes = make_nodes(g, 2);
1074 auto nodes = make_nodes(g, 2);
1086 auto nodes = make_nodes(g, 4);
1104 auto nodes = make_nodes(g, 4);
1110 auto b1 =
cb.find_bridges();
1121 auto nodes = make_nodes(g, 6);
1131 auto b1 =
cb.find_bridges();
1132 auto b2 =
cb.find_bridges();
1143 auto nodes = make_nodes(g,
N);
1144 for (
int i = 0; i <
N - 1; ++i)
1155 auto nodes = make_nodes(g, 4);
1175 auto nodes = make_nodes(g, 5);
1177 for (
int i = 1; i < 5; ++i)
1190 auto nodes = make_nodes(g, 3);
1207 auto nodes = make_nodes(g, 6);
1216 for (
int start = 0; start < 6; ++start)
1230 auto nodes = make_nodes(g, 4);
1259 auto nodes = make_nodes(g, 6);
Simple dynamic array with automatic resizing and functional operations.
static Array create(size_t n)
Create an array with n logical elements.
Find bridge edges (isthmuses) of a connected undirected graph.
Computation of cut nodes (articulation points) of a graph.
bool has_curr() const noexcept
Return true if the iterator has current item.
constexpr bool is_empty() const noexcept
Return true if this (as header node) is empty.
Dynamic doubly linked list with O(1) size and bidirectional access.
const size_t & size() const noexcept
Return the number of elements (constant time)
Iterator on the items of list.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
Dynamic set backed by balanced binary search trees with automatic memory management.
Key * insert(const Key &key)
Inserts a key into the dynamic set.
bool has_curr() const noexcept
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Arc Arc
The node class type.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
auto get_arc_it() const noexcept
Obtains an iterator to the arc of graph.
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
constexpr size_t get_num_arcs() const noexcept
auto get_node_it() const noexcept
Obtains an iterator to the nodes of graph.
DynArray< Graph::Node * > nodes
DynArray< Graph::Arc * > arcs
DynList< typename GT::Arc * > find_bridges(const GT &g, typename GT::Node *start, SA sa=SA())
Find all bridge edges in a connected undirected graph.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
static long & color(typename GT::Node *p)
Arc of graph implemented with double-linked adjacency lists.
Dynamic array container with automatic resizing.
Articulation points (cut nodes), bridges, and biconnected components.
Dynamic set implementations based on balanced binary search trees.
Generic graph and digraph implementations.
Utility algorithms and operations for graphs.