Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
graph_contract_matrix_matching_test.cc
Go to the documentation of this file.
1/*
2 Aleph_w
3
4 Data structures & Algorithms
5 version 2.0.0b
6 https://github.com/lrleon/Aleph-w
7
8 This file is part of Aleph-w library
9
10 Copyright (c) 2002-2026 Leandro Rabindranath Leon
11
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in all
20 copies or substantial portions of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 SOFTWARE.
29*/
30
49#include <set>
50#include <stdexcept>
51#include <type_traits>
52#include <utility>
53#include <vector>
54
55#include <gtest/gtest.h>
56
57#include <tpl_graph.H>
58#include <tpl_bipartite.H>
59#include <Blossom.H>
60#include <Blossom_Weighted.H>
61#include <Min_Cost_Matching.H>
62
63#include "graph_harness.H"
66
67using namespace Aleph;
68using namespace graph_harness;
69using namespace graph_contract_matrix;
70
71namespace
72{
75 template <class SA>
76 constexpr bool default_built = std::is_default_constructible_v<SA>;
77
78
80 template <class List>
81 std::set<int> arc_numbers(const List & l)
82 {
83 std::set<int> r;
84 for (auto it = l.get_it(); it.has_curr(); it.next_ne())
85 r.insert(it.get_curr()->get_info());
86 return r;
87 }
88} // namespace
89
90namespace
91{
93 template <class GT, class SA>
94 size_t counted(const SA & sa)
95 {
96 if constexpr (std::is_same_v<SA, graph_filters::Counting<GT>>)
97 return sa.calls == nullptr ? 0 : *sa.calls;
98 else
99 return 0;
100 }
101
104 template <class GT, class SA>
105 void expect_called(const SA & sa, size_t before)
106 {
107 if constexpr (std::is_same_v<SA, graph_filters::Counting<GT>>)
108 {
109 EXPECT_GT(counted<GT>(sa), before) << "the filter given is not the one used";
110 }
111 }
112
116 Spec path_spec()
117 {
118 Spec s;
119 s.n = 4;
120 s.arcs = {{0, 1}, {2, 1}, {2, 3}};
121 return s;
122 }
123
133 template <class GT>
134 struct Oriented_Cycle
135 {
136 GT g;
137 std::vector<typename GT::Node *> nodes;
138
139 Oriented_Cycle()
140 {
141 for (int i = 0; i < 4; ++i)
142 nodes.push_back(g.insert_node(i));
143 const int left = typename GT::Node_Iterator(g).get_curr()->get_info() % 2;
144 for (int i = 0; i < 4; ++i)
145 {
146 int u = i, v = (i + 1) % 4;
147 if (u % 2 != left)
148 std::swap(u, v);
149 g.insert_arc(nodes[size_t(u)], nodes[size_t(v)], i);
150 }
151 }
152
153 Oriented_Cycle(const Oriented_Cycle &) = delete;
154 Oriented_Cycle & operator = (const Oriented_Cycle &) = delete;
155 };
156
159 template <class List>
160 void expect_cycle_matching(const List & m, bool hidden)
161 {
162 const auto arcs = arc_numbers(m);
163 if (hidden)
164 {
165 EXPECT_EQ(arcs, (std::set<int>{1, 3}));
166 }
167 else
168 {
169 EXPECT_TRUE(arcs == (std::set<int>{0, 2}) or arcs == (std::set<int>{1, 3}))
170 << m.size() << " arcs";
171 }
172 }
173
176 Spec triangle_spec()
177 {
178 Spec s;
179 s.n = 3;
180 s.arcs = {{0, 1}, {1, 2}, {0, 2}};
181 return s;
182 }
183
185 template <class List>
186 std::set<int> node_numbers(const List & l)
187 {
188 std::set<int> r;
189 for (auto it = l.get_it(); it.has_curr(); it.next_ne())
190 r.insert(it.get_curr()->get_info());
191 return r;
192 }
193
197 template <class List>
198 void expect_path_bipartition(const List & l, const List & r)
199 {
200 const std::set<std::set<int>> sides = {node_numbers(l), node_numbers(r)};
201 EXPECT_EQ(sides, (std::set<std::set<int>>{{0, 2}, {1}}));
202 }
203
205 template <class List>
206 void expect_maximum_matching(const List & m, bool hidden)
207 {
208 const auto arcs = arc_numbers(m);
209 if (hidden)
210 {
211 EXPECT_EQ(m.size(), 1U);
212 EXPECT_EQ(arcs.count(Hidden), 0U);
213 }
214 else
215 {
216 EXPECT_EQ(arcs, (std::set<int>{0, 2}));
217 }
218 }
219} // namespace
220
221// ---------------------------------------------------------------------
222// tpl_bipartite.H: the filter by value, which a default argument builds
223// ---------------------------------------------------------------------
224
225template <class GT>
226class ContractMatchingBipartite : public ::testing::Test {};
227
229
231{
232 using GT = TypeParam;
233 Built<GT> b(triangle_spec());
234
235 for_each_filter<GT>([&] (auto sa, const char * name)
236 {
237 using SA = decltype(sa);
238 constexpr bool h = hides<GT, SA>;
239 SCOPED_TRACE(name);
240 for_each_constness(b.g, [&] (auto & g)
241 {
242 DynDlist<typename GT::Node *> l, r, l2, r2;
243 Compute_Bipartite<GT, SA> bipartite(sa);
244 if constexpr (h)
245 {
246 const size_t before = counted<GT>(sa);
247 compute_bipartite<GT, SA>(g, l, r, sa);
248 expect_path_bipartition(l, r);
249 expect_called<GT>(sa, before);
250 bipartite(g, l2, r2);
251 expect_path_bipartition(l2, r2);
252 }
253 else
254 {
255 EXPECT_THROW_OR_FILTER((compute_bipartite<GT, SA>(g, l, r, sa)), std::domain_error);
256 EXPECT_THROW_OR_FILTER(bipartite(g, l2, r2), std::domain_error);
257 }
258
259 if constexpr (default_built<SA>) // a filter built by default hides nothing
260 {
262 EXPECT_THROW_OR_FILTER((compute_bipartite<GT, SA>(g, l3, r3)), std::domain_error);
263 EXPECT_THROW_OR_FILTER((Compute_Bipartite<GT, SA>()(g, l3, r3)), std::domain_error);
264 }
265 });
266 });
267}
268
269TYPED_TEST(ContractMatchingBipartite, ComputeBipartiteAllComponents)
270{
271 using GT = TypeParam;
272 Built<GT> b(triangle_spec());
273
274 for_each_filter<GT>([&] (auto sa, const char * name)
275 {
276 using SA = decltype(sa);
277 constexpr bool h = hides<GT, SA>;
278 SCOPED_TRACE(name);
279 for_each_constness(b.g, [&] (auto & g)
280 {
281 DynDlist<typename GT::Node *> l, r;
282 const size_t before = counted<GT>(sa);
283 const bool bipartite = compute_bipartite_all_components<GT, SA>(g, l, r, sa);
284 EXPECT_EQ(bipartite, h);
285 if (bipartite)
286 {
287 expect_path_bipartition(l, r);
288 }
289 expect_called<GT>(sa, before);
290
291 if constexpr (default_built<SA>)
292 {
294 EXPECT_FALSE((compute_bipartite_all_components<GT, SA>(g, l2, r2)));
295 }
296 });
297 });
298}
299
300TYPED_TEST(ContractMatchingBipartite, MaximumCardinalityBipartiteMatching)
301{
302 using GT = TypeParam;
303 Oriented_Cycle<GT> b;
304
305 for_each_filter<GT>([&] (auto sa, const char * name)
306 {
307 using SA = decltype(sa);
308 constexpr bool h = hides<GT, SA>;
309 SCOPED_TRACE(name);
310 for_each_constness(b.g, [&] (auto & g)
311 {
312 DynDlist<typename GT::Arc *> m, m2;
313 const size_t before = counted<GT>(sa);
314 compute_maximum_cardinality_bipartite_matching
315 <GT, Ford_Fulkerson_Maximum_Flow, SA>(g, m, sa);
316 expect_cycle_matching(m, h);
317 expect_called<GT>(sa, before);
318
319 Compute_Maximum_Cardinality_Bipartite_Matching
320 <GT, Ford_Fulkerson_Maximum_Flow, SA> matching(sa);
321 matching(g, m2);
322 expect_cycle_matching(m2, h);
323
324 if constexpr (default_built<SA>)
325 {
326 DynDlist<typename GT::Arc *> m3;
327 Compute_Maximum_Cardinality_Bipartite_Matching
328 <GT, Ford_Fulkerson_Maximum_Flow, SA>()(g, m3);
329 expect_cycle_matching(m3, false);
330 }
331 });
332 });
333}
334
336{
337 using GT = TypeParam;
338 Built<GT> b(path_spec());
339
340 for_each_filter<GT>([&] (auto sa, const char * name)
341 {
342 using SA = decltype(sa);
343 constexpr bool h = hides<GT, SA>;
344 SCOPED_TRACE(name);
345 for_each_constness(b.g, [&] (auto & g)
346 {
347 DynDlist<typename GT::Arc *> m, m2;
348 const size_t before = counted<GT>(sa);
349 hopcroft_karp_matching<GT, SA>(g, m, sa);
350 expect_maximum_matching(m, h);
351 expect_called<GT>(sa, before);
352
353 Hopcroft_Karp_Matching<GT, SA> matching(sa);
354 matching(g, m2);
355 expect_maximum_matching(m2, h);
356
357 if constexpr (default_built<SA>)
358 {
359 DynDlist<typename GT::Arc *> m3;
360 Hopcroft_Karp_Matching<GT, SA>()(g, m3);
361 expect_maximum_matching(m3, false);
362 }
363 });
364 });
365}
366
367namespace
368{
371 template <class GT>
372 struct Counting_Defaults
373 {
374 static inline size_t built = 0;
375
376 Counting_Defaults() noexcept { ++built; }
377
378 bool operator () (typename GT::Arc * a) const noexcept
379 {
380 return a->get_info() != Hidden;
381 }
382 };
383}
384
385// The bipartition, the iterators and the frames of the search copy the
386// filter given, and build none with SA(): no state of a filter reached the
387// search when they did
388TYPED_TEST(ContractMatchingBipartite, HopcroftKarpCopiesTheFilterGiven)
389{
390 using GT = TypeParam;
391 using SA = Counting_Defaults<GT>;
392 Built<GT> b(path_spec());
393
394 SA sa;
395 SA::built = 0;
397 hopcroft_karp_matching<GT, SA>(b.g, m, sa);
398 expect_maximum_matching(m, true);
401 matching(b.g, m2);
402 expect_maximum_matching(m2, true);
403 EXPECT_EQ(SA::built, 0U);
404
406 hopcroft_karp_matching<GT, SA>(b.g, m3); // that of the default argument
407 expect_maximum_matching(m3, true);
408 EXPECT_EQ(SA::built, 1U);
409}
410
411// ---------------------------------------------------------------------
412// Blossom.H: maximum cardinality, the filter by value
413// ---------------------------------------------------------------------
414
415template <class GT>
416class ContractMatchingBlossom : public ::testing::Test {};
417
419
420TYPED_TEST(ContractMatchingBlossom, MaximumCardinalityGeneralMatching)
421{
422 using GT = TypeParam;
423 Built<GT> b(path_spec());
424
425 for_each_filter<GT>([&] (auto sa, const char * name)
426 {
427 using SA = decltype(sa);
428 SCOPED_TRACE(name);
429 for_each_constness(b.g, [&] (auto & g)
430 {
431 DynDlist<typename GT::Arc *> m;
432 const size_t before = counted<GT>(sa);
433 const size_t n = compute_maximum_cardinality_general_matching(g, m, sa);
434 EXPECT_EQ(n, m.size());
435 expect_maximum_matching(m, hides<GT, SA>);
436 expect_called<GT>(sa, before);
437 });
438 });
439}
440
441TYPED_TEST(ContractMatchingBlossom, BlossomMaximumCardinalityMatching)
442{
443 using GT = TypeParam;
444 Built<GT> b(path_spec());
445
446 for_each_filter<GT>([&] (auto sa, const char * name)
447 {
448 using SA = decltype(sa);
449 SCOPED_TRACE(name);
450 for_each_constness(b.g, [&] (auto & g)
451 {
452 DynDlist<typename GT::Arc *> m;
453 const size_t n = blossom_maximum_cardinality_matching(g, m, sa);
454 EXPECT_EQ(n, m.size());
455 expect_maximum_matching(m, hides<GT, SA>);
456 });
457 });
458}
459
460TYPED_TEST(ContractMatchingBlossom, ComputeMaximumCardinalityGeneralMatching)
461{
462 using GT = TypeParam;
463 Built<GT> b(path_spec());
464
465 for_each_filter<GT>([&] (auto sa, const char * name)
466 {
467 using SA = decltype(sa);
468 SCOPED_TRACE(name);
469 for_each_constness(b.g, [&] (auto & g)
470 {
471 DynDlist<typename GT::Arc *> m;
472 const size_t before = counted<GT>(sa);
473 Compute_Maximum_Cardinality_General_Matching<GT, SA> matcher(sa);
474 EXPECT_EQ(matcher(g, m), m.size());
475 expect_maximum_matching(m, hides<GT, SA>);
476 expect_called<GT>(sa, before);
477 });
478 });
479}
480
481// ---------------------------------------------------------------------
482// Blossom_Weighted.H and Min_Cost_Matching.H: the weights are the arc
483// numbers, 0, 1 and 2
484// ---------------------------------------------------------------------
485
486namespace
487{
491 template <class List, class Result>
492 void expect_maximum_weight(const List & m, const Result & r, bool hidden,
493 bool max_cardinality)
494 {
495 EXPECT_EQ(r.cardinality, m.size());
496 if (hidden)
497 {
498 EXPECT_EQ(r.total_weight, 1);
499 EXPECT_EQ(arc_numbers(m), (std::set<int>{1}));
500 }
501 else
502 {
503 EXPECT_EQ(r.total_weight, 2);
504 EXPECT_EQ(arc_numbers(m).count(Hidden), 1U);
505 if (max_cardinality)
506 {
507 EXPECT_EQ(arc_numbers(m), (std::set<int>{0, 2}));
508 }
509 }
510 }
511
514 template <class List, class Result>
515 void expect_minimum_cost(const List & m, const Result & r, bool hidden)
516 {
517 EXPECT_EQ(r.cardinality, m.size());
518 if (hidden)
519 {
520 EXPECT_EQ(r.total_cost, 0);
521 EXPECT_EQ(arc_numbers(m), (std::set<int>{0}));
522 }
523 else
524 {
525 EXPECT_EQ(r.total_cost, 2);
526 EXPECT_EQ(arc_numbers(m), (std::set<int>{0, 2}));
527 }
528 }
529
532 template <class List, class Result>
533 void expect_perfect(const List & m, const Result & r, bool hidden)
534 {
535 if (hidden)
536 {
537 EXPECT_FALSE(r.feasible);
538 EXPECT_TRUE(m.is_empty());
539 }
540 else
541 {
542 EXPECT_TRUE(r.feasible);
543 EXPECT_EQ(r.total_cost, 2);
544 EXPECT_EQ(arc_numbers(m), (std::set<int>{0, 2}));
545 }
546 }
547} // namespace
548
549template <class GT>
550class ContractMatchingWeighted : public ::testing::Test {};
551
553
554TYPED_TEST(ContractMatchingWeighted, MaximumWeightGeneralMatching)
555{
556 using GT = TypeParam;
557 Built<GT> b(path_spec());
558
559 for_each_filter<GT>([&] (auto sa, const char * name)
560 {
561 using SA = decltype(sa);
562 SCOPED_TRACE(name);
563 for_each_constness(b.g, [&] (auto & g)
564 {
565 for (bool max_cardinality : {false, true})
566 {
568 const size_t before = counted<GT>(sa);
570 (g, m, Dft_Dist<GT>(), sa, max_cardinality);
571 expect_maximum_weight(m, r, hides<GT, SA>, max_cardinality);
572 expect_called<GT>(sa, before);
573 }
574 });
575 });
576}
577
578TYPED_TEST(ContractMatchingWeighted, BlossomMaximumWeightMatching)
579{
580 using GT = TypeParam;
581 Built<GT> b(path_spec());
582
583 for_each_filter<GT>([&] (auto sa, const char * name)
584 {
585 using SA = decltype(sa);
586 SCOPED_TRACE(name);
587 for_each_constness(b.g, [&] (auto & g)
588 {
589 for (bool max_cardinality : {false, true})
590 {
593 (g, m, Dft_Dist<GT>(), sa, max_cardinality);
594 expect_maximum_weight(m, r, hides<GT, SA>, max_cardinality);
595 }
596 });
597 });
598}
599
600TYPED_TEST(ContractMatchingWeighted, ComputeMaximumWeightGeneralMatching)
601{
602 using GT = TypeParam;
603 Built<GT> b(path_spec());
604
605 for_each_filter<GT>([&] (auto sa, const char * name)
606 {
607 using SA = decltype(sa);
608 SCOPED_TRACE(name);
609 for_each_constness(b.g, [&] (auto & g)
610 {
611 DynDlist<typename GT::Arc *> m;
612 Compute_Maximum_Weight_General_Matching<GT, Dft_Dist<GT>, SA>
613 matcher(Dft_Dist<GT>(), sa, true);
614 const auto r = matcher(g, m);
615 expect_maximum_weight(m, r, hides<GT, SA>, true);
616 });
617 });
618}
619
620TYPED_TEST(ContractMatchingWeighted, MinimumCostGeneralMatching)
621{
622 using GT = TypeParam;
623 Built<GT> b(path_spec());
624
625 for_each_filter<GT>([&] (auto sa, const char * name)
626 {
627 using SA = decltype(sa);
628 SCOPED_TRACE(name);
629 for_each_constness(b.g, [&] (auto & g)
630 {
631 DynDlist<typename GT::Arc *> m, m2;
632 const size_t before = counted<GT>(sa);
633 const auto r = compute_minimum_cost_general_matching
634 (g, m, Dft_Dist<GT>(), sa, true);
635 expect_minimum_cost(m, r, hides<GT, SA>);
636 expect_called<GT>(sa, before);
637
638 // Without the cardinality first, a matching of cost 0 is enough
639 const auto r2 = compute_minimum_cost_general_matching(g, m2, Dft_Dist<GT>(), sa);
640 EXPECT_EQ(r2.total_cost, 0);
641 EXPECT_EQ(arc_numbers(m2).count(Hidden), 0U);
642 });
643 });
644}
645
646TYPED_TEST(ContractMatchingWeighted, BlossomMinimumCostMatching)
647{
648 using GT = TypeParam;
649 Built<GT> b(path_spec());
650
651 for_each_filter<GT>([&] (auto sa, const char * name)
652 {
653 using SA = decltype(sa);
654 SCOPED_TRACE(name);
655 for_each_constness(b.g, [&] (auto & g)
656 {
657 DynDlist<typename GT::Arc *> m;
658 const auto r = blossom_minimum_cost_matching(g, m, Dft_Dist<GT>(), sa, true);
659 expect_minimum_cost(m, r, hides<GT, SA>);
660 });
661 });
662}
663
664TYPED_TEST(ContractMatchingWeighted, MinimumCostPerfectGeneralMatching)
665{
666 using GT = TypeParam;
667 Built<GT> b(path_spec());
668
669 for_each_filter<GT>([&] (auto sa, const char * name)
670 {
671 using SA = decltype(sa);
672 SCOPED_TRACE(name);
673 for_each_constness(b.g, [&] (auto & g)
674 {
675 DynDlist<typename GT::Arc *> m, m2;
676 const size_t before = counted<GT>(sa);
677 const auto r = compute_minimum_cost_perfect_general_matching(g, m, Dft_Dist<GT>(), sa);
678 expect_perfect(m, r, hides<GT, SA>);
679 expect_called<GT>(sa, before);
680
681 const auto r2 = blossom_minimum_cost_perfect_matching(g, m2, Dft_Dist<GT>(), sa);
682 expect_perfect(m2, r2, hides<GT, SA>);
683 });
684 });
685}
686
687TYPED_TEST(ContractMatchingWeighted, MinimumCostMatchingClasses)
688{
689 using GT = TypeParam;
690 Built<GT> b(path_spec());
691
692 for_each_filter<GT>([&] (auto sa, const char * name)
693 {
694 using SA = decltype(sa);
695 SCOPED_TRACE(name);
696 for_each_constness(b.g, [&] (auto & g)
697 {
698 DynDlist<typename GT::Arc *> m, m2;
699 Compute_Minimum_Cost_General_Matching<GT, Dft_Dist<GT>, SA>
700 matcher(Dft_Dist<GT>(), sa, true);
701 expect_minimum_cost(m, matcher(g, m), hides<GT, SA>);
702
703 Compute_Minimum_Cost_Perfect_General_Matching<GT, Dft_Dist<GT>, SA>
704 perfect(Dft_Dist<GT>(), sa);
705 expect_perfect(m2, perfect(g, m2), hides<GT, SA>);
706 });
707 });
708}
Edmonds' Blossom algorithm for maximum matching in general graphs.
Maximum-weight matching in general undirected graphs.
Minimum-cost matching in general undirected graphs.
long double h
Definition btreepic.C:154
Class that takes a bipartite graph and computes the partition sets.
Default distance accessor for arc weights.
Node belonging to a double circular linked list with header node.
Definition tpl_dnode.H:106
Dynamic doubly linked list with O(1) size and bidirectional access.
Functor wrapper for hopcroft_karp_matching.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Definition tpl_graph.H:535
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Definition tpl_graph.H:618
auto get_it()
Return a properly initialized iterator positioned at the first item on the container.
Definition ah-dry.H:663
constexpr size_t size() const noexcept
Returns the number of entries in the table.
Definition hashDry.H:954
constexpr bool is_empty() const noexcept
Checks if the table is empty.
Definition hashDry.H:959
What the files of the contract matrix of the graph templates, graph_contract_matrix_*_test....
TYPED_TEST(ContractMatchingBipartite, ComputeBipartite)
TYPED_TEST_SUITE(ContractMatchingBipartite, Undirected_Kinds)
The kinds of arc filter and of distance that the graph algorithms must accept.
Every small multigraph, on every kind of graph, for the tests.
#define EXPECT_THROW_OR_FILTER(statement, type)
EXPECT_THROW(statement, type), for a statement that calls a filter: in a call of graph_harness::with_...
DynArray< Graph::Node * > nodes
Definition graphpic.C:406
DynArray< Graph::Arc * > arcs
Definition graphpic.C:408
Blossom_Weighted_Result< long long > compute_maximum_weight_general_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, Weight weight=Weight(), SA sa=SA(), const bool max_cardinality=false)
Compute maximum-weight matching in a general undirected graph.
Blossom_Weighted_Result< long long > blossom_maximum_weight_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, Weight weight=Weight(), SA sa=SA(), const bool max_cardinality=false)
Alias for compute_maximum_weight_general_matching().
Main namespace for Aleph-w library functions.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
Definition ahAlgo.H:127
void for_each_constness(GT &g, F &&f)
Calls f(g) with g as it is and as a const graph.
constexpr int Hidden
The number of the arc that the filters hide.
::testing::Types< Aleph::List_Graph< Aleph::Graph_Node< int >, Aleph::Graph_Arc< int > >, Aleph::List_SGraph< Aleph::Graph_Snode< int >, Aleph::Graph_Sarc< int > >, Aleph::Array_Graph< Aleph::Graph_Anode< int >, Aleph::Graph_Aarc< int > > > Undirected_Kinds
The kinds of graph that are not directed, with int infos.
A graph made from a spec, with its nodes and arcs by number.
A small multigraph: its nodes are 0 .
std::vector< std::array< int, 2 > > arcs
FooMap m(5, fst_unit_pair_hash, snd_unit_pair_hash)
DynList< char > l3
DynList< int > l2
Gsl_Compatible_Rng r
Bipartite graph detection and 2-coloring.
Generic graph and digraph implementations.
DynList< int > l