klao@962
|
1 |
/* -*- C++ -*-
|
klao@962
|
2 |
*
|
klao@962
|
3 |
* src/lemon/concept/undir_graph_component.h - Part of LEMON, a generic
|
klao@962
|
4 |
* C++ optimization library
|
klao@962
|
5 |
*
|
alpar@1164
|
6 |
* Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi
|
klao@962
|
7 |
* Kutatocsoport (Egervary Combinatorial Optimization Research Group,
|
klao@962
|
8 |
* EGRES).
|
klao@962
|
9 |
*
|
klao@962
|
10 |
* Permission to use, modify and distribute this software is granted
|
klao@962
|
11 |
* provided that this copyright notice appears in all copies. For
|
klao@962
|
12 |
* precise terms see the accompanying LICENSE file.
|
klao@962
|
13 |
*
|
klao@962
|
14 |
* This software is provided "AS IS" with no warranty of any kind,
|
klao@962
|
15 |
* express or implied, and with no claim as to its suitability for any
|
klao@962
|
16 |
* purpose.
|
klao@962
|
17 |
*
|
klao@962
|
18 |
*/
|
klao@962
|
19 |
|
klao@1030
|
20 |
///\ingroup graph_concepts
|
klao@962
|
21 |
///\file
|
klao@962
|
22 |
///\brief Undirected graphs and components of.
|
klao@962
|
23 |
|
klao@962
|
24 |
|
klao@962
|
25 |
#ifndef LEMON_CONCEPT_UNDIR_GRAPH_H
|
klao@962
|
26 |
#define LEMON_CONCEPT_UNDIR_GRAPH_H
|
klao@962
|
27 |
|
klao@962
|
28 |
#include <lemon/concept/graph_component.h>
|
klao@962
|
29 |
|
klao@962
|
30 |
namespace lemon {
|
klao@962
|
31 |
namespace concept {
|
klao@962
|
32 |
|
klao@1030
|
33 |
/// \addtogroup graph_concepts
|
klao@1030
|
34 |
/// @{
|
klao@1030
|
35 |
|
klao@1030
|
36 |
|
klao@1030
|
37 |
/// Skeleton class which describes an edge with direction in \ref
|
klao@1030
|
38 |
/// UndirGraph "undirected graph".
|
klao@1158
|
39 |
template <typename UndirGraph>
|
klao@1158
|
40 |
class UndirGraphEdge : public UndirGraph::UndirEdge {
|
klao@1158
|
41 |
typedef typename UndirGraph::UndirEdge UndirEdge;
|
klao@1158
|
42 |
typedef typename UndirGraph::Node Node;
|
klao@1030
|
43 |
public:
|
klao@1030
|
44 |
|
klao@1030
|
45 |
/// \e
|
klao@1030
|
46 |
UndirGraphEdge() {}
|
klao@1030
|
47 |
|
klao@1030
|
48 |
/// \e
|
klao@1030
|
49 |
UndirGraphEdge(const UndirGraphEdge&) {}
|
klao@1030
|
50 |
|
klao@1030
|
51 |
/// \e
|
klao@1030
|
52 |
UndirGraphEdge(Invalid) {}
|
klao@1030
|
53 |
|
klao@1158
|
54 |
/// \brief Directed edge from undirected edge and a source node.
|
klao@1030
|
55 |
///
|
klao@1158
|
56 |
/// Constructs a directed edge from undirected edge and a source node.
|
klao@1158
|
57 |
///
|
klao@1158
|
58 |
/// \note You have to specify the graph for this constructor.
|
klao@1158
|
59 |
UndirGraphEdge(const UndirGraph &g,
|
klao@1158
|
60 |
UndirEdge undir_edge, Node n) {
|
klao@1030
|
61 |
ignore_unused_variable_warning(undir_edge);
|
klao@1158
|
62 |
ignore_unused_variable_warning(g);
|
klao@1158
|
63 |
ignore_unused_variable_warning(n);
|
klao@1030
|
64 |
}
|
klao@1030
|
65 |
|
klao@1030
|
66 |
/// \e
|
klao@1030
|
67 |
UndirGraphEdge& operator=(UndirGraphEdge) { return *this; }
|
klao@1030
|
68 |
|
klao@1030
|
69 |
/// \e
|
klao@1030
|
70 |
bool operator==(UndirGraphEdge) const { return true; }
|
klao@1030
|
71 |
/// \e
|
klao@1030
|
72 |
bool operator!=(UndirGraphEdge) const { return false; }
|
klao@1030
|
73 |
|
klao@1030
|
74 |
/// \e
|
klao@1030
|
75 |
bool operator<(UndirGraphEdge) const { return false; }
|
klao@1030
|
76 |
|
klao@1030
|
77 |
template <typename Edge>
|
klao@1030
|
78 |
struct Constraints {
|
klao@1030
|
79 |
void constraints() {
|
klao@1158
|
80 |
const_constraints();
|
klao@1158
|
81 |
}
|
klao@1158
|
82 |
void const_constraints() const {
|
klao@1030
|
83 |
/// \bug This should be is_base_and_derived ...
|
klao@1030
|
84 |
UndirEdge ue = e;
|
klao@1030
|
85 |
ue = e;
|
klao@1030
|
86 |
|
klao@1158
|
87 |
Edge e_with_source(graph,ue,n);
|
klao@1158
|
88 |
ignore_unused_variable_warning(e_with_source);
|
klao@1030
|
89 |
}
|
klao@1030
|
90 |
Edge e;
|
klao@1158
|
91 |
UndirEdge ue;
|
klao@1158
|
92 |
UndirGraph graph;
|
klao@1158
|
93 |
Node n;
|
klao@1030
|
94 |
};
|
klao@1030
|
95 |
};
|
klao@1030
|
96 |
|
klao@962
|
97 |
|
klao@962
|
98 |
struct BaseIterableUndirGraphConcept {
|
deba@989
|
99 |
|
klao@1022
|
100 |
template <typename Graph>
|
klao@1022
|
101 |
struct Constraints {
|
klao@962
|
102 |
|
klao@1022
|
103 |
typedef typename Graph::UndirEdge UndirEdge;
|
klao@1022
|
104 |
typedef typename Graph::Edge Edge;
|
klao@1022
|
105 |
typedef typename Graph::Node Node;
|
klao@962
|
106 |
|
klao@1022
|
107 |
void constraints() {
|
klao@1022
|
108 |
checkConcept<BaseIterableGraphComponent, Graph>();
|
klao@1030
|
109 |
checkConcept<GraphItem<>, UndirEdge>();
|
klao@1158
|
110 |
checkConcept<UndirGraphEdge<Graph>, Edge>();
|
klao@962
|
111 |
|
klao@1030
|
112 |
graph.first(ue);
|
klao@1030
|
113 |
graph.next(ue);
|
klao@1022
|
114 |
|
klao@1030
|
115 |
const_constraints();
|
klao@1030
|
116 |
}
|
klao@1030
|
117 |
void const_constraints() {
|
klao@1022
|
118 |
Node n;
|
klao@1022
|
119 |
n = graph.target(ue);
|
klao@1022
|
120 |
n = graph.source(ue);
|
klao@1030
|
121 |
n = graph.oppositeNode(n0, ue);
|
klao@1022
|
122 |
|
klao@1030
|
123 |
bool b;
|
klao@1030
|
124 |
b = graph.forward(e);
|
klao@1030
|
125 |
ignore_unused_variable_warning(b);
|
klao@1022
|
126 |
}
|
klao@1030
|
127 |
|
klao@1030
|
128 |
Graph graph;
|
klao@1022
|
129 |
Edge e;
|
klao@1030
|
130 |
Node n0;
|
klao@1030
|
131 |
UndirEdge ue;
|
klao@1022
|
132 |
};
|
klao@1022
|
133 |
|
klao@962
|
134 |
};
|
klao@962
|
135 |
|
klao@1022
|
136 |
|
klao@962
|
137 |
struct IterableUndirGraphConcept {
|
klao@962
|
138 |
|
klao@1022
|
139 |
template <typename Graph>
|
klao@1022
|
140 |
struct Constraints {
|
klao@1022
|
141 |
void constraints() {
|
klao@1022
|
142 |
/// \todo we don't need the iterable component to be base iterable
|
klao@1022
|
143 |
/// Don't we really???
|
klao@1022
|
144 |
//checkConcept< BaseIterableUndirGraphConcept, Graph > ();
|
klao@962
|
145 |
|
klao@1022
|
146 |
checkConcept<IterableGraphComponent, Graph> ();
|
klao@1021
|
147 |
|
klao@1022
|
148 |
typedef typename Graph::UndirEdge UndirEdge;
|
klao@1022
|
149 |
typedef typename Graph::UndirEdgeIt UndirEdgeIt;
|
klao@1030
|
150 |
typedef typename Graph::IncEdgeIt IncEdgeIt;
|
klao@1022
|
151 |
|
klao@1022
|
152 |
checkConcept<GraphIterator<Graph, UndirEdge>, UndirEdgeIt>();
|
klao@1030
|
153 |
checkConcept<GraphIncIterator<Graph, UndirEdge>, IncEdgeIt>();
|
klao@1022
|
154 |
}
|
klao@1022
|
155 |
};
|
klao@1022
|
156 |
|
klao@1022
|
157 |
};
|
klao@1022
|
158 |
|
klao@1022
|
159 |
struct MappableUndirGraphConcept {
|
klao@1022
|
160 |
|
klao@1022
|
161 |
template <typename Graph>
|
klao@1022
|
162 |
struct Constraints {
|
klao@1022
|
163 |
|
klao@1022
|
164 |
struct Dummy {
|
klao@1022
|
165 |
int value;
|
klao@1022
|
166 |
Dummy() : value(0) {}
|
klao@1022
|
167 |
Dummy(int _v) : value(_v) {}
|
klao@1022
|
168 |
};
|
klao@1022
|
169 |
|
klao@1022
|
170 |
void constraints() {
|
klao@1022
|
171 |
checkConcept<MappableGraphComponent, Graph>();
|
klao@1022
|
172 |
|
klao@1022
|
173 |
typedef typename Graph::template UndirEdgeMap<int> IntMap;
|
klao@1022
|
174 |
checkConcept<GraphMap<Graph, typename Graph::UndirEdge, int>,
|
klao@1022
|
175 |
IntMap >();
|
klao@1022
|
176 |
|
klao@1022
|
177 |
typedef typename Graph::template UndirEdgeMap<bool> BoolMap;
|
klao@1022
|
178 |
checkConcept<GraphMap<Graph, typename Graph::UndirEdge, bool>,
|
klao@1022
|
179 |
BoolMap >();
|
klao@1022
|
180 |
|
klao@1022
|
181 |
typedef typename Graph::template UndirEdgeMap<Dummy> DummyMap;
|
klao@1022
|
182 |
checkConcept<GraphMap<Graph, typename Graph::UndirEdge, Dummy>,
|
klao@1022
|
183 |
DummyMap >();
|
klao@1022
|
184 |
}
|
klao@1022
|
185 |
};
|
klao@1022
|
186 |
|
klao@1022
|
187 |
};
|
klao@1022
|
188 |
|
klao@1022
|
189 |
struct ExtendableUndirGraphConcept {
|
klao@1022
|
190 |
|
klao@1022
|
191 |
template <typename Graph>
|
klao@1022
|
192 |
struct Constraints {
|
klao@1022
|
193 |
void constraints() {
|
klao@1022
|
194 |
node_a = graph.addNode();
|
klao@1022
|
195 |
uedge = graph.addEdge(node_a, node_b);
|
klao@1022
|
196 |
}
|
klao@1022
|
197 |
typename Graph::Node node_a, node_b;
|
klao@1022
|
198 |
typename Graph::UndirEdge uedge;
|
klao@1022
|
199 |
Graph graph;
|
klao@1022
|
200 |
};
|
klao@1022
|
201 |
|
klao@1022
|
202 |
};
|
klao@1022
|
203 |
|
klao@1022
|
204 |
struct ErasableUndirGraphConcept {
|
klao@1022
|
205 |
|
klao@1022
|
206 |
template <typename Graph>
|
klao@1022
|
207 |
struct Constraints {
|
klao@1022
|
208 |
void constraints() {
|
klao@1022
|
209 |
graph.erase(n);
|
klao@1022
|
210 |
graph.erase(e);
|
klao@1022
|
211 |
}
|
klao@1022
|
212 |
Graph graph;
|
klao@1022
|
213 |
typename Graph::Node n;
|
klao@1022
|
214 |
typename Graph::UndirEdge e;
|
klao@1022
|
215 |
};
|
klao@1022
|
216 |
|
klao@1022
|
217 |
};
|
klao@1022
|
218 |
|
klao@1030
|
219 |
/// Class describing the concept of Undirected Graphs.
|
klao@1030
|
220 |
|
klao@1030
|
221 |
/// This class describes the common interface of all Undirected
|
klao@1030
|
222 |
/// Graphs.
|
klao@1030
|
223 |
///
|
klao@1030
|
224 |
/// As all concept describing classes it provides only interface
|
klao@1030
|
225 |
/// without any sensible implementation. So any algorithm for
|
klao@1030
|
226 |
/// undirected graph should compile with this class, but it will not
|
klao@1030
|
227 |
/// run properly, of couse.
|
klao@1030
|
228 |
///
|
klao@1030
|
229 |
/// In LEMON undirected graphs also fulfill the concept of directed
|
klao@1030
|
230 |
/// graphs (\ref lemon::concept::Graph "Graph Concept"). For
|
klao@1030
|
231 |
/// explanation of this and more see also the page \ref undir_graphs,
|
klao@1030
|
232 |
/// a tutorial about undirected graphs.
|
klao@1030
|
233 |
|
klao@1022
|
234 |
class UndirGraph {
|
klao@1022
|
235 |
public:
|
klao@1022
|
236 |
|
klao@1030
|
237 |
/// Type describing a node in the graph
|
klao@1030
|
238 |
typedef GraphNode Node;
|
klao@1030
|
239 |
|
klao@1030
|
240 |
/// Type describing an undirected edge
|
klao@1030
|
241 |
typedef GraphItem<'u'> UndirEdge;
|
klao@1030
|
242 |
|
klao@1030
|
243 |
/// Type describing an UndirEdge with direction
|
klao@1030
|
244 |
#ifndef DOXYGEN
|
klao@1158
|
245 |
typedef UndirGraphEdge<UndirGraph> Edge;
|
klao@1030
|
246 |
#else
|
klao@1030
|
247 |
typedef UndirGraphEdge Edge;
|
klao@1030
|
248 |
#endif
|
klao@1030
|
249 |
|
klao@1030
|
250 |
/// Iterator type which iterates over all nodes
|
klao@1030
|
251 |
#ifndef DOXYGEN
|
klao@1030
|
252 |
typedef GraphIterator<UndirGraph, Node> NodeIt;
|
klao@1030
|
253 |
#else
|
klao@1030
|
254 |
typedef GraphIterator NodeIt;
|
klao@1030
|
255 |
#endif
|
klao@1030
|
256 |
|
klao@1030
|
257 |
/// Iterator type which iterates over all undirected edges
|
klao@1030
|
258 |
#ifndef DOXYGEN
|
klao@1030
|
259 |
typedef GraphIterator<UndirGraph, UndirEdge> UndirEdgeIt;
|
klao@1030
|
260 |
#else
|
klao@1030
|
261 |
typedef GraphIterator UndirEdgeIt;
|
klao@1030
|
262 |
#endif
|
klao@1030
|
263 |
|
klao@1030
|
264 |
/// Iterator type which iterates over all directed edges.
|
klao@1030
|
265 |
|
klao@1030
|
266 |
/// Iterator type which iterates over all edges (each undirected
|
klao@1030
|
267 |
/// edge occurs twice with both directions.
|
klao@1030
|
268 |
#ifndef DOXYGEN
|
klao@1030
|
269 |
typedef GraphIterator<UndirGraph, Edge> EdgeIt;
|
klao@1030
|
270 |
#else
|
klao@1030
|
271 |
typedef GraphIterator EdgeIt;
|
klao@1030
|
272 |
#endif
|
klao@1030
|
273 |
|
klao@1030
|
274 |
|
klao@1030
|
275 |
/// Iterator of undirected edges incident to a node
|
klao@1030
|
276 |
#ifndef DOXYGEN
|
klao@1030
|
277 |
typedef GraphIncIterator<UndirGraph, UndirEdge, 'u'> IncEdgeIt;
|
klao@1030
|
278 |
#else
|
klao@1030
|
279 |
typedef GraphIncIterator IncEdgeIt;
|
klao@1030
|
280 |
#endif
|
klao@1030
|
281 |
|
klao@1030
|
282 |
/// Iterator of edges incoming to a node
|
klao@1030
|
283 |
#ifndef DOXYGEN
|
klao@1030
|
284 |
typedef GraphIncIterator<UndirGraph, Edge, 'i'> InEdgeIt;
|
klao@1030
|
285 |
#else
|
klao@1030
|
286 |
typedef GraphIncIterator InEdgeIt;
|
klao@1030
|
287 |
#endif
|
klao@1030
|
288 |
|
klao@1030
|
289 |
/// Iterator of edges outgoing from a node
|
klao@1030
|
290 |
#ifndef DOXYGEN
|
klao@1030
|
291 |
typedef GraphIncIterator<UndirGraph, Edge, 'o'> OutEdgeIt;
|
klao@1030
|
292 |
#else
|
klao@1030
|
293 |
typedef GraphIncIterator OutEdgeIt;
|
klao@1030
|
294 |
#endif
|
klao@1030
|
295 |
|
klao@1030
|
296 |
/// NodeMap template
|
klao@1030
|
297 |
#ifdef DOXYGEN
|
klao@1030
|
298 |
typedef GraphMap NodeMap<T>;
|
klao@1030
|
299 |
#endif
|
klao@1030
|
300 |
|
klao@1030
|
301 |
/// UndirEdgeMap template
|
klao@1030
|
302 |
#ifdef DOXYGEN
|
klao@1030
|
303 |
typedef GraphMap UndirEdgeMap<T>;
|
klao@1030
|
304 |
#endif
|
klao@1030
|
305 |
|
klao@1030
|
306 |
/// EdgeMap template
|
klao@1030
|
307 |
#ifdef DOXYGEN
|
klao@1030
|
308 |
typedef GraphMap EdgeMap<T>;
|
klao@1030
|
309 |
#endif
|
klao@1030
|
310 |
|
klao@1030
|
311 |
template <typename T>
|
klao@1030
|
312 |
class NodeMap : public GraphMap<UndirGraph, Node, T> {
|
klao@1030
|
313 |
typedef GraphMap<UndirGraph, Node, T> Parent;
|
klao@1030
|
314 |
public:
|
klao@1030
|
315 |
|
klao@1030
|
316 |
explicit NodeMap(const UndirGraph &g) : Parent(g) {}
|
klao@1030
|
317 |
NodeMap(const UndirGraph &g, T t) : Parent(g, t) {}
|
klao@1030
|
318 |
};
|
klao@1030
|
319 |
|
klao@1030
|
320 |
template <typename T>
|
klao@1030
|
321 |
class UndirEdgeMap : public GraphMap<UndirGraph, UndirEdge, T> {
|
klao@1030
|
322 |
typedef GraphMap<UndirGraph, UndirEdge, T> Parent;
|
klao@1030
|
323 |
public:
|
klao@1030
|
324 |
|
klao@1030
|
325 |
explicit UndirEdgeMap(const UndirGraph &g) : Parent(g) {}
|
klao@1030
|
326 |
UndirEdgeMap(const UndirGraph &g, T t) : Parent(g, t) {}
|
klao@1030
|
327 |
};
|
klao@1030
|
328 |
|
klao@1030
|
329 |
template <typename T>
|
klao@1030
|
330 |
class EdgeMap : public GraphMap<UndirGraph, Edge, T> {
|
klao@1030
|
331 |
typedef GraphMap<UndirGraph, Edge, T> Parent;
|
klao@1030
|
332 |
public:
|
klao@1030
|
333 |
|
klao@1030
|
334 |
explicit EdgeMap(const UndirGraph &g) : Parent(g) {}
|
klao@1030
|
335 |
EdgeMap(const UndirGraph &g, T t) : Parent(g, t) {}
|
klao@1030
|
336 |
};
|
klao@1030
|
337 |
|
klao@1030
|
338 |
/// Is the Edge oriented "forward"?
|
klao@1030
|
339 |
|
klao@1030
|
340 |
/// Returns whether the given directed edge is same orientation as
|
klao@1030
|
341 |
/// the corresponding undirected edge.
|
klao@1030
|
342 |
///
|
klao@1030
|
343 |
/// \todo "What does the direction of an undirected edge mean?"
|
klao@1030
|
344 |
bool forward(Edge) const { return true; }
|
klao@1030
|
345 |
|
klao@1030
|
346 |
/// Opposite node on an edge
|
klao@1030
|
347 |
|
klao@1030
|
348 |
/// \return the opposite of the given Node on the given Edge
|
klao@1030
|
349 |
///
|
klao@1030
|
350 |
/// \todo What should we do if given Node and Edge are not incident?
|
klao@1030
|
351 |
Node oppositeNode(Node, UndirEdge) const { return INVALID; }
|
klao@1030
|
352 |
|
klao@1030
|
353 |
/// First node of the undirected edge.
|
klao@1030
|
354 |
|
klao@1030
|
355 |
/// \return the first node of the given UndirEdge.
|
klao@1030
|
356 |
///
|
klao@1030
|
357 |
/// Naturally undirectected edges don't have direction and thus
|
klao@1030
|
358 |
/// don't have source and target node. But we use these two methods
|
klao@1030
|
359 |
/// to query the two endnodes of the edge. The direction of the edge
|
klao@1030
|
360 |
/// which arises this way is called the inherent direction of the
|
klao@1030
|
361 |
/// undirected edge, and is used to define the "forward" direction
|
klao@1030
|
362 |
/// of the directed versions of the edges.
|
klao@1030
|
363 |
/// \sa forward
|
klao@1030
|
364 |
Node source(UndirEdge) const { return INVALID; }
|
klao@1030
|
365 |
|
klao@1030
|
366 |
/// Second node of the undirected edge.
|
klao@1030
|
367 |
Node target(UndirEdge) const { return INVALID; }
|
klao@1030
|
368 |
|
klao@1030
|
369 |
/// Source node of the directed edge.
|
klao@1030
|
370 |
Node source(Edge) const { return INVALID; }
|
klao@1030
|
371 |
|
klao@1030
|
372 |
/// Target node of the directed edge.
|
klao@1030
|
373 |
Node target(Edge) const { return INVALID; }
|
klao@1030
|
374 |
|
klao@1030
|
375 |
/// First node of the graph
|
klao@1030
|
376 |
|
klao@1030
|
377 |
/// \note This method is part of so called \ref
|
klao@1030
|
378 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
379 |
/// be used in an end-user program.
|
klao@1030
|
380 |
void first(Node&) const {}
|
klao@1030
|
381 |
/// Next node of the graph
|
klao@1030
|
382 |
|
klao@1030
|
383 |
/// \note This method is part of so called \ref
|
klao@1030
|
384 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
385 |
/// be used in an end-user program.
|
klao@1030
|
386 |
void next(Node&) const {}
|
klao@1030
|
387 |
|
klao@1030
|
388 |
/// First undirected edge of the graph
|
klao@1030
|
389 |
|
klao@1030
|
390 |
/// \note This method is part of so called \ref
|
klao@1030
|
391 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
392 |
/// be used in an end-user program.
|
klao@1030
|
393 |
void first(UndirEdge&) const {}
|
klao@1030
|
394 |
/// Next undirected edge of the graph
|
klao@1030
|
395 |
|
klao@1030
|
396 |
/// \note This method is part of so called \ref
|
klao@1030
|
397 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
398 |
/// be used in an end-user program.
|
klao@1030
|
399 |
void next(UndirEdge&) const {}
|
klao@1030
|
400 |
|
klao@1030
|
401 |
/// First directed edge of the graph
|
klao@1030
|
402 |
|
klao@1030
|
403 |
/// \note This method is part of so called \ref
|
klao@1030
|
404 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
405 |
/// be used in an end-user program.
|
klao@1030
|
406 |
void first(Edge&) const {}
|
klao@1030
|
407 |
/// Next directed edge of the graph
|
klao@1030
|
408 |
|
klao@1030
|
409 |
/// \note This method is part of so called \ref
|
klao@1030
|
410 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
411 |
/// be used in an end-user program.
|
klao@1030
|
412 |
void next(Edge&) const {}
|
klao@1030
|
413 |
|
klao@1030
|
414 |
/// First outgoing edge from a given node
|
klao@1030
|
415 |
|
klao@1030
|
416 |
/// \note This method is part of so called \ref
|
klao@1030
|
417 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
418 |
/// be used in an end-user program.
|
klao@1030
|
419 |
void firstOut(Edge&, Node) const {}
|
klao@1030
|
420 |
/// Next outgoing edge to a node
|
klao@1030
|
421 |
|
klao@1030
|
422 |
/// \note This method is part of so called \ref
|
klao@1030
|
423 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
424 |
/// be used in an end-user program.
|
klao@1030
|
425 |
void nextOut(Edge&) const {}
|
klao@1030
|
426 |
|
klao@1030
|
427 |
/// First incoming edge to a given node
|
klao@1030
|
428 |
|
klao@1030
|
429 |
/// \note This method is part of so called \ref
|
klao@1030
|
430 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
431 |
/// be used in an end-user program.
|
klao@1030
|
432 |
void firstIn(Edge&, Node) const {}
|
klao@1030
|
433 |
/// Next incoming edge to a node
|
klao@1030
|
434 |
|
klao@1030
|
435 |
/// \note This method is part of so called \ref
|
klao@1030
|
436 |
/// developpers_interface "Developpers' interface", so it shouldn't
|
klao@1030
|
437 |
/// be used in an end-user program.
|
klao@1030
|
438 |
void nextIn(Edge&) const {}
|
klao@1030
|
439 |
|
klao@1030
|
440 |
|
klao@1158
|
441 |
/// Base node of the iterator
|
klao@1158
|
442 |
///
|
klao@1158
|
443 |
/// Returns the base node (the source in this case) of the iterator
|
klao@1158
|
444 |
Node baseNode(OutEdgeIt e) const {
|
klao@1158
|
445 |
return source(e);
|
klao@1158
|
446 |
}
|
klao@1158
|
447 |
/// Running node of the iterator
|
klao@1158
|
448 |
///
|
klao@1158
|
449 |
/// Returns the running node (the target in this case) of the
|
klao@1158
|
450 |
/// iterator
|
klao@1158
|
451 |
Node runningNode(OutEdgeIt e) const {
|
klao@1158
|
452 |
return target(e);
|
klao@1158
|
453 |
}
|
klao@1158
|
454 |
|
klao@1158
|
455 |
/// Base node of the iterator
|
klao@1158
|
456 |
///
|
klao@1158
|
457 |
/// Returns the base node (the target in this case) of the iterator
|
klao@1158
|
458 |
Node baseNode(InEdgeIt e) const {
|
klao@1158
|
459 |
return target(e);
|
klao@1158
|
460 |
}
|
klao@1158
|
461 |
/// Running node of the iterator
|
klao@1158
|
462 |
///
|
klao@1158
|
463 |
/// Returns the running node (the source in this case) of the
|
klao@1158
|
464 |
/// iterator
|
klao@1158
|
465 |
Node runningNode(InEdgeIt e) const {
|
klao@1158
|
466 |
return source(e);
|
klao@1158
|
467 |
}
|
klao@1158
|
468 |
|
klao@1158
|
469 |
/// Base node of the iterator
|
klao@1158
|
470 |
///
|
klao@1158
|
471 |
/// Returns the base node of the iterator
|
klao@1158
|
472 |
Node baseNode(IncEdgeIt e) const {
|
klao@1158
|
473 |
return INVALID;
|
klao@1158
|
474 |
}
|
klao@1158
|
475 |
/// Running node of the iterator
|
klao@1158
|
476 |
///
|
klao@1158
|
477 |
/// Returns the running node of the iterator
|
klao@1158
|
478 |
Node runningNode(IncEdgeIt e) const {
|
klao@1158
|
479 |
return INVALID;
|
klao@1158
|
480 |
}
|
klao@1158
|
481 |
|
klao@1158
|
482 |
|
klao@1022
|
483 |
template <typename Graph>
|
klao@1022
|
484 |
struct Constraints {
|
klao@1022
|
485 |
void constraints() {
|
klao@1022
|
486 |
checkConcept<BaseIterableUndirGraphConcept, Graph>();
|
klao@1022
|
487 |
checkConcept<IterableUndirGraphConcept, Graph>();
|
klao@1022
|
488 |
checkConcept<MappableUndirGraphConcept, Graph>();
|
klao@1022
|
489 |
}
|
klao@1022
|
490 |
};
|
klao@1022
|
491 |
|
klao@1022
|
492 |
};
|
klao@1022
|
493 |
|
klao@1022
|
494 |
class ExtendableUndirGraph : public UndirGraph {
|
klao@1022
|
495 |
public:
|
klao@1022
|
496 |
|
klao@1022
|
497 |
template <typename Graph>
|
klao@1022
|
498 |
struct Constraints {
|
klao@1022
|
499 |
void constraints() {
|
klao@1022
|
500 |
checkConcept<BaseIterableUndirGraphConcept, Graph>();
|
klao@1022
|
501 |
checkConcept<IterableUndirGraphConcept, Graph>();
|
klao@1022
|
502 |
checkConcept<MappableUndirGraphConcept, Graph>();
|
klao@1022
|
503 |
|
klao@1022
|
504 |
checkConcept<UndirGraph, Graph>();
|
klao@1022
|
505 |
checkConcept<ExtendableUndirGraphConcept, Graph>();
|
klao@1022
|
506 |
checkConcept<ClearableGraphComponent, Graph>();
|
klao@1022
|
507 |
}
|
klao@1022
|
508 |
};
|
klao@1022
|
509 |
|
klao@1022
|
510 |
};
|
klao@1022
|
511 |
|
klao@1022
|
512 |
class ErasableUndirGraph : public ExtendableUndirGraph {
|
klao@1022
|
513 |
public:
|
klao@1022
|
514 |
|
klao@1022
|
515 |
template <typename Graph>
|
klao@1022
|
516 |
struct Constraints {
|
klao@1022
|
517 |
void constraints() {
|
klao@1022
|
518 |
checkConcept<ExtendableUndirGraph, Graph>();
|
klao@1022
|
519 |
checkConcept<ErasableUndirGraphConcept, Graph>();
|
klao@1022
|
520 |
}
|
klao@1022
|
521 |
};
|
klao@1022
|
522 |
|
klao@962
|
523 |
};
|
klao@962
|
524 |
|
klao@1030
|
525 |
/// @}
|
klao@1030
|
526 |
|
klao@962
|
527 |
}
|
klao@962
|
528 |
|
klao@962
|
529 |
}
|
klao@962
|
530 |
|
klao@962
|
531 |
#endif
|