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 <tpl_dynSetTree.H>
43
44namespace Aleph {
45
58template <class GT,
59 class SN = Dft_Show_Node<GT>,
60 class SA = Dft_Show_Arc<GT> >
62{
63 SN & sn;
64 SA & sa;
65
66 typedef typename GT::Node GT_Node;
67
68public:
69
70 Test_Single_Graph(SN && __sn = SN(), SA && __sa = SA())
71 : sn(__sn), sa(__sa)
72 {
73 // empty
74 }
75
77 bool test_node(typename GT::Node * p)
78 {
80
81 for (Node_Arc_Iterator<GT, SA> it(p, sa); it.has_curr(); it.next_ne())
82 {
83 GT_Node * q = it.get_tgt_node_ne();
84 if (nodes.exist(q))
85 return false;
86 else
87 nodes.insert(p);
88 }
89
90 return true;
91 }
92
93 bool operator () (GT & g)
94 {
95 for (Node_Iterator<GT, SN> it(g, sn); it.has_curr(); it.next_ne())
96 if (not test_node(it.get_curr()))
97 return false;
98
99 return true;
100 }
101};
102
103
104
105} // end namespace Aleph
106
107# endif // SINGLE_GRAPH_H_H
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:1206
Determina si un grafo o digrafo es simple.
bool test_node(typename GT::Node *p)
retorna true si p no tiene multiarcos ni lazos
Test_Single_Graph(SN &&__sn=SN(), SA &&__sa=SA())
List_Graph< Graph_Node< int >, Graph_Arc< int > > GT
DynArray< Graph::Node * > nodes
Definition graphpic.C:406
Main namespace for Aleph-w library functions.
Definition ah-arena.H:89
DynList< T > maps(const C &c, Op op)
Classic map operation.
Default filter for filtered iterators on arcs.
Definition tpl_graph.H:1000
Default filter for the graph nodes.
Definition tpl_graph.H:1192
Filtered iterator of adjacent arcs of a node.
Definition tpl_graph.H:1119
Dynamic set implementations based on balanced binary search trees.