38#include <gtest/gtest.h>
53 std::vector<Graph::Node *> make_nodes(
Graph & g,
int n)
55 std::vector<Graph::Node *>
nodes;
57 for (
int i = 0; i < n; ++i)
66 s.
insert(it.get_curr()->get_info());
73 for (
auto it = g.
get_node_it(); it.has_curr(); it.next_ne())
75 auto p = it.get_curr();
85 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
87 auto a = it.get_curr();
97 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
108 auto nodes = make_nodes(g, 4);
123 auto nodes = make_nodes(g, 4);
139 auto nodes = make_nodes(g, 6);
140 const int center = 0;
141 for (
int i = 1; i < 6; ++i)
154 auto nodes = make_nodes(g, 2);
166 auto nodes = make_nodes(g, 5);
167 for (
int i = 1; i < 5; ++i)
179 for (
int i = 1; i < 5; ++i)
197 auto nodes = make_nodes(g, 5);
198 for (
int i = 1; i < 5; ++i)
220 auto nodes = make_nodes(g, 4);
245 auto nodes = make_nodes(g, 4);
247 for (
int i = 0; i < 4; ++i)
248 for (
int j = i + 1; j < 4; ++j)
261 auto nodes = make_nodes(g, 7);
286 auto nodes = make_nodes(g, 6);
306 auto nodes = make_nodes(g, 4);
323 auto nodes = make_nodes(g, 5);
346 auto nodes = make_nodes(g, 3);
360 auto nodes = make_nodes(g, 3);
375 auto nodes = make_nodes(g, 3);
398 auto nodes = make_nodes(g, 3);
422 auto nodes = make_nodes(g, 4);
437 auto nodes = make_nodes(g, 4);
456 auto nodes = make_nodes(g, 5);
458 for (
int i = 1; i < 5; ++i)
473 for (
int i = 1; i < 5; ++i)
485 auto nodes = make_nodes(g, 3);
492 alg.paint_subgraphs();
496 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
506 auto nodes = make_nodes(g, 6);
519 alg.paint_subgraphs();
527 auto nodes = make_nodes(g, 7);
553 auto nodes = make_nodes(g, 3);
559 alg.paint_subgraphs();
568 auto nodes = make_nodes(g, 5);
569 for (
int i = 1; i < 5; ++i)
575 alg.paint_subgraphs();
591 auto nodes = make_nodes(g, 3);
598 alg.paint_subgraphs();
601 alg.map_subgraph(sg, 1L);
604 for (
auto it = sg.
get_node_it(); it.has_curr(); it.next_ne())
619 auto nodes = make_nodes(g, 5);
628 alg.paint_subgraphs();
640 auto nodes = make_nodes(g, 3);
647 alg.paint_subgraphs();
655 for (
auto it = g.
get_arc_it(); it.has_curr(); it.next_ne())
669 auto nodes = make_nodes(g, 2);
684 auto nodes = make_nodes(g, 5);
685 for (
int i = 1; i < 5; ++i)
704 auto nodes = make_nodes(g, 7);
727 auto nodes = make_nodes(g, 5);
748 auto nodes = make_nodes(g, 3);
771 auto nodes = make_nodes(g, 1);
783 auto nodes = make_nodes(g, 2);
796 auto nodes = make_nodes(g, 3);
811 auto nodes = make_nodes(g, 3);
826 auto nodes = make_nodes(g, 3);
845 auto nodes = make_nodes(g, 5);
846 for (
int i = 1; i < 5; ++i)
876 auto nodes = make_nodes(g, 4);
895 auto nodes = make_nodes(g,
N);
898 for (
int i = 0; i <
N - 1; ++i)
911 auto nodes = make_nodes(g, 3);
917 alg.paint_subgraphs();
923 alg.map_subgraph(sg, 999L);
925 catch (
const std::domain_error &)
Computation of cut nodes (articulation points) of a graph.
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)
T & insert(const T &item)
Insert a new item by copy.
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)
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
Main namespace for Aleph-w library functions.
static long & color(typename GT::Node *p)
DynList< T > maps(const C &c, Op op)
Classic map operation.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
Arc of graph implemented with double-linked adjacency lists.
Articulation points (cut nodes) and bridges.
Generic graph and digraph implementations.
Utility algorithms and operations for graphs.