Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
single_graph.H
Go to the documentation of this file.
1
2/*
3 Aleph_w
4
5 Data structures & Algorithms
6 version 2.0.0b
7 https://github.com/lrleon/Aleph-w
8
9 This file is part of Aleph-w library
10
11 Copyright (c) 2002-2026 Leandro Rabindranath Leon
12
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the Software is
18 furnished to do so, subject to the following conditions:
19
20 The above copyright notice and this permission notice shall be included in all
21 copies or substantial portions of the Software.
22
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 SOFTWARE.
30*/
31
32
39# ifndef SINGLE_GRAPH_H
40# define SINGLE_GRAPH_H
41
42# include <ah-graph-concepts.H>
43
44# include <tpl_dynSetTree.H>
45
46namespace Aleph {
47
60template <AlephGraph GT,
64{
65 SN & sn;
66 SA & sa;
67
68 typedef typename GT::Node GT_Node;
69
70public:
71
72 Test_Single_Graph(SN && __sn = SN(), SA && __sa = SA())
73 : sn(__sn), sa(__sa)
74 {
75 // empty
76 }
77
79 bool test_node(typename GT::Node * p)
80 {
82
83 for (Node_Arc_Iterator<GT, SA> it(p, sa); it.has_curr(); it.next_ne())
84 {
85 GT_Node * q = it.get_tgt_node_ne();
86 if (nodes.exist(q))
87 return false;
88 else
89 nodes.insert(p);
90 }
91
92 return true;
93 }
94
95 bool operator () (GT & g)
96 {
97 for (Node_Iterator<GT, SN> it(g, sn); it.has_curr(); it.next_ne())
98 if (not test_node(it.get_curr()))
99 return false;
100
101 return true;
102 }
103};
104
105
106
107} // end namespace Aleph
108
109# endif // SINGLE_GRAPH_H_H
C++20 concepts for the protocol shared by graph algorithms.
List_Graph< Graph_Node< Node_Info >, Graph_Arc< Arc_Info > > GT
Dynamic set implemented using AVL binary search trees of type Avl_Tree<Key>.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
Filtered iterator on the nodes of a graph.
Definition tpl_graph.H:1207
Determines whether a graph or digraph is simple.
bool test_node(typename GT::Node *p)
Returns true if p has neither multi-arcs nor self-loops.
Test_Single_Graph(SN &&__sn=SN(), SA &&__sa=SA())
DynArray< Graph::Node * > nodes
Definition graphpic.C:406
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Definition Blossom.H:466
Main namespace for Aleph-w library functions.
Definition ah-arena.H:89
Default filter for filtered iterators on arcs.
Definition tpl_graph.H:1001
Default filter for the graph nodes.
Definition tpl_graph.H:1193
Filtered iterator of adjacent arcs of a node.
Definition tpl_graph.H:1120
Dynamic set implementations based on balanced binary search trees.