deba@1018
|
1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*-
|
deba@1018
|
2 |
*
|
deba@1018
|
3 |
* This file is a part of LEMON, a generic C++ optimization library.
|
deba@1018
|
4 |
*
|
deba@1018
|
5 |
* Copyright (C) 2003-2010
|
deba@1018
|
6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
|
deba@1018
|
7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES).
|
deba@1018
|
8 |
*
|
deba@1018
|
9 |
* Permission to use, modify and distribute this software is granted
|
deba@1018
|
10 |
* provided that this copyright notice appears in all copies. For
|
deba@1018
|
11 |
* precise terms see the accompanying LICENSE file.
|
deba@1018
|
12 |
*
|
deba@1018
|
13 |
* This software is provided "AS IS" with no warranty of any kind,
|
deba@1018
|
14 |
* express or implied, and with no claim as to its suitability for any
|
deba@1018
|
15 |
* purpose.
|
deba@1018
|
16 |
*
|
deba@1018
|
17 |
*/
|
deba@1018
|
18 |
|
deba@1018
|
19 |
///\ingroup graph_concepts
|
deba@1018
|
20 |
///\file
|
deba@1018
|
21 |
///\brief The concept of undirected graphs.
|
deba@1018
|
22 |
|
deba@1018
|
23 |
#ifndef LEMON_CONCEPTS_BPGRAPH_H
|
deba@1018
|
24 |
#define LEMON_CONCEPTS_BPGRAPH_H
|
deba@1018
|
25 |
|
deba@1018
|
26 |
#include <lemon/concepts/graph_components.h>
|
deba@1018
|
27 |
#include <lemon/concepts/maps.h>
|
deba@1018
|
28 |
#include <lemon/concept_check.h>
|
deba@1018
|
29 |
#include <lemon/core.h>
|
deba@1018
|
30 |
|
deba@1018
|
31 |
namespace lemon {
|
deba@1018
|
32 |
namespace concepts {
|
deba@1018
|
33 |
|
deba@1018
|
34 |
/// \ingroup graph_concepts
|
deba@1018
|
35 |
///
|
deba@1018
|
36 |
/// \brief Class describing the concept of undirected bipartite graphs.
|
deba@1018
|
37 |
///
|
deba@1018
|
38 |
/// This class describes the common interface of all undirected
|
deba@1018
|
39 |
/// bipartite graphs.
|
deba@1018
|
40 |
///
|
deba@1018
|
41 |
/// Like all concept classes, it only provides an interface
|
deba@1018
|
42 |
/// without any sensible implementation. So any general algorithm for
|
deba@1018
|
43 |
/// undirected bipartite graphs should compile with this class,
|
deba@1018
|
44 |
/// but it will not run properly, of course.
|
deba@1018
|
45 |
/// An actual graph implementation like \ref ListBpGraph or
|
deba@1018
|
46 |
/// \ref SmartBpGraph may have additional functionality.
|
deba@1018
|
47 |
///
|
deba@1018
|
48 |
/// The bipartite graphs also fulfill the concept of \ref Graph
|
deba@1018
|
49 |
/// "undirected graphs". Bipartite graphs provide a bipartition of
|
deba@1018
|
50 |
/// the node set, namely a red and blue set of the nodes. The
|
deba@1018
|
51 |
/// nodes can be iterated with the RedIt and BlueIt in the two
|
deba@1018
|
52 |
/// node sets. With RedMap and BlueMap values can be assigned to
|
deba@1018
|
53 |
/// the nodes in the two sets.
|
deba@1018
|
54 |
///
|
deba@1018
|
55 |
/// The edges of the graph cannot connect two nodes of the same
|
deba@1018
|
56 |
/// set. The edges inherent orientation is from the red nodes to
|
deba@1018
|
57 |
/// the blue nodes.
|
deba@1018
|
58 |
///
|
deba@1018
|
59 |
/// \sa Graph
|
deba@1018
|
60 |
class BpGraph {
|
deba@1018
|
61 |
private:
|
deba@1018
|
62 |
/// BpGraphs are \e not copy constructible. Use bpGraphCopy instead.
|
deba@1018
|
63 |
BpGraph(const BpGraph&) {}
|
deba@1018
|
64 |
/// \brief Assignment of a graph to another one is \e not allowed.
|
deba@1018
|
65 |
/// Use bpGraphCopy instead.
|
deba@1018
|
66 |
void operator=(const BpGraph&) {}
|
deba@1018
|
67 |
|
deba@1018
|
68 |
public:
|
deba@1018
|
69 |
/// Default constructor.
|
deba@1018
|
70 |
BpGraph() {}
|
deba@1018
|
71 |
|
deba@1018
|
72 |
/// \brief Undirected graphs should be tagged with \c UndirectedTag.
|
deba@1018
|
73 |
///
|
deba@1018
|
74 |
/// Undirected graphs should be tagged with \c UndirectedTag.
|
deba@1018
|
75 |
///
|
deba@1018
|
76 |
/// This tag helps the \c enable_if technics to make compile time
|
deba@1018
|
77 |
/// specializations for undirected graphs.
|
deba@1018
|
78 |
typedef True UndirectedTag;
|
deba@1018
|
79 |
|
deba@1018
|
80 |
/// The node type of the graph
|
deba@1018
|
81 |
|
deba@1018
|
82 |
/// This class identifies a node of the graph. It also serves
|
deba@1018
|
83 |
/// as a base class of the node iterators,
|
deba@1018
|
84 |
/// thus they convert to this type.
|
deba@1018
|
85 |
class Node {
|
deba@1018
|
86 |
public:
|
deba@1018
|
87 |
/// Default constructor
|
deba@1018
|
88 |
|
deba@1018
|
89 |
/// Default constructor.
|
deba@1018
|
90 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
91 |
Node() { }
|
deba@1018
|
92 |
/// Copy constructor.
|
deba@1018
|
93 |
|
deba@1018
|
94 |
/// Copy constructor.
|
deba@1018
|
95 |
///
|
deba@1018
|
96 |
Node(const Node&) { }
|
deba@1018
|
97 |
|
deba@1018
|
98 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
99 |
|
deba@1018
|
100 |
/// Initializes the object to be invalid.
|
deba@1018
|
101 |
/// \sa Invalid for more details.
|
deba@1018
|
102 |
Node(Invalid) { }
|
deba@1018
|
103 |
/// Equality operator
|
deba@1018
|
104 |
|
deba@1018
|
105 |
/// Equality operator.
|
deba@1018
|
106 |
///
|
deba@1018
|
107 |
/// Two iterators are equal if and only if they point to the
|
deba@1018
|
108 |
/// same object or both are \c INVALID.
|
deba@1018
|
109 |
bool operator==(Node) const { return true; }
|
deba@1018
|
110 |
|
deba@1018
|
111 |
/// Inequality operator
|
deba@1018
|
112 |
|
deba@1018
|
113 |
/// Inequality operator.
|
deba@1018
|
114 |
bool operator!=(Node) const { return true; }
|
deba@1018
|
115 |
|
deba@1018
|
116 |
/// Artificial ordering operator.
|
deba@1018
|
117 |
|
deba@1018
|
118 |
/// Artificial ordering operator.
|
deba@1018
|
119 |
///
|
deba@1018
|
120 |
/// \note This operator only has to define some strict ordering of
|
deba@1018
|
121 |
/// the items; this order has nothing to do with the iteration
|
deba@1018
|
122 |
/// ordering of the items.
|
deba@1018
|
123 |
bool operator<(Node) const { return false; }
|
deba@1018
|
124 |
|
deba@1018
|
125 |
};
|
deba@1018
|
126 |
|
deba@1018
|
127 |
/// Class to represent red nodes.
|
deba@1018
|
128 |
|
deba@1018
|
129 |
/// This class represents the red nodes of the graph. It does
|
deba@1018
|
130 |
/// not supposed to be used directly, because the nodes can be
|
deba@1018
|
131 |
/// represented as Node instances. This class can be used as
|
deba@1018
|
132 |
/// template parameter for special map classes.
|
deba@1018
|
133 |
class RedNode : public Node {
|
deba@1018
|
134 |
public:
|
deba@1018
|
135 |
/// Default constructor
|
deba@1018
|
136 |
|
deba@1018
|
137 |
/// Default constructor.
|
deba@1018
|
138 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
139 |
RedNode() { }
|
deba@1018
|
140 |
/// Copy constructor.
|
deba@1018
|
141 |
|
deba@1018
|
142 |
/// Copy constructor.
|
deba@1018
|
143 |
///
|
deba@1018
|
144 |
RedNode(const RedNode&) : Node() { }
|
deba@1018
|
145 |
|
deba@1018
|
146 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
147 |
|
deba@1018
|
148 |
/// Initializes the object to be invalid.
|
deba@1018
|
149 |
/// \sa Invalid for more details.
|
deba@1018
|
150 |
RedNode(Invalid) { }
|
deba@1018
|
151 |
|
deba@1018
|
152 |
/// Constructor for conversion from a node.
|
deba@1018
|
153 |
|
deba@1018
|
154 |
/// Constructor for conversion from a node. The conversion can
|
deba@1018
|
155 |
/// be invalid, since the Node can be member of the blue
|
deba@1018
|
156 |
/// set.
|
deba@1018
|
157 |
RedNode(const Node&) {}
|
deba@1018
|
158 |
};
|
deba@1018
|
159 |
|
deba@1018
|
160 |
/// Class to represent blue nodes.
|
deba@1018
|
161 |
|
deba@1018
|
162 |
/// This class represents the blue nodes of the graph. It does
|
deba@1018
|
163 |
/// not supposed to be used directly, because the nodes can be
|
deba@1018
|
164 |
/// represented as Node instances. This class can be used as
|
deba@1018
|
165 |
/// template parameter for special map classes.
|
deba@1018
|
166 |
class BlueNode : public Node {
|
deba@1018
|
167 |
public:
|
deba@1018
|
168 |
/// Default constructor
|
deba@1018
|
169 |
|
deba@1018
|
170 |
/// Default constructor.
|
deba@1018
|
171 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
172 |
BlueNode() { }
|
deba@1018
|
173 |
/// Copy constructor.
|
deba@1018
|
174 |
|
deba@1018
|
175 |
/// Copy constructor.
|
deba@1018
|
176 |
///
|
deba@1018
|
177 |
BlueNode(const BlueNode&) : Node() { }
|
deba@1018
|
178 |
|
deba@1018
|
179 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
180 |
|
deba@1018
|
181 |
/// Initializes the object to be invalid.
|
deba@1018
|
182 |
/// \sa Invalid for more details.
|
deba@1018
|
183 |
BlueNode(Invalid) { }
|
deba@1018
|
184 |
|
deba@1018
|
185 |
/// Constructor for conversion from a node.
|
deba@1018
|
186 |
|
deba@1018
|
187 |
/// Constructor for conversion from a node. The conversion can
|
deba@1018
|
188 |
/// be invalid, since the Node can be member of the red
|
deba@1018
|
189 |
/// set.
|
deba@1018
|
190 |
BlueNode(const Node&) {}
|
deba@1018
|
191 |
};
|
deba@1018
|
192 |
|
deba@1018
|
193 |
/// Iterator class for the red nodes.
|
deba@1018
|
194 |
|
deba@1018
|
195 |
/// This iterator goes through each red node of the graph.
|
deba@1018
|
196 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
197 |
/// of red nodes in a graph \c g of type \c %BpGraph like this:
|
deba@1018
|
198 |
///\code
|
deba@1018
|
199 |
/// int count=0;
|
deba@1018
|
200 |
/// for (BpGraph::RedNodeIt n(g); n!=INVALID; ++n) ++count;
|
deba@1018
|
201 |
///\endcode
|
deba@1018
|
202 |
class RedIt : public Node {
|
deba@1018
|
203 |
public:
|
deba@1018
|
204 |
/// Default constructor
|
deba@1018
|
205 |
|
deba@1018
|
206 |
/// Default constructor.
|
deba@1018
|
207 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
208 |
RedIt() { }
|
deba@1018
|
209 |
/// Copy constructor.
|
deba@1018
|
210 |
|
deba@1018
|
211 |
/// Copy constructor.
|
deba@1018
|
212 |
///
|
deba@1018
|
213 |
RedIt(const RedIt& n) : Node(n) { }
|
deba@1018
|
214 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
215 |
|
deba@1018
|
216 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
217 |
/// \sa Invalid for more details.
|
deba@1018
|
218 |
RedIt(Invalid) { }
|
deba@1018
|
219 |
/// Sets the iterator to the first red node.
|
deba@1018
|
220 |
|
deba@1018
|
221 |
/// Sets the iterator to the first red node of the given
|
deba@1018
|
222 |
/// digraph.
|
deba@1018
|
223 |
explicit RedIt(const BpGraph&) { }
|
deba@1018
|
224 |
/// Sets the iterator to the given red node.
|
deba@1018
|
225 |
|
deba@1018
|
226 |
/// Sets the iterator to the given red node of the given
|
deba@1018
|
227 |
/// digraph.
|
deba@1018
|
228 |
RedIt(const BpGraph&, const Node&) { }
|
deba@1018
|
229 |
/// Next node.
|
deba@1018
|
230 |
|
deba@1018
|
231 |
/// Assign the iterator to the next red node.
|
deba@1018
|
232 |
///
|
deba@1018
|
233 |
RedIt& operator++() { return *this; }
|
deba@1018
|
234 |
};
|
deba@1018
|
235 |
|
deba@1018
|
236 |
/// Iterator class for the blue nodes.
|
deba@1018
|
237 |
|
deba@1018
|
238 |
/// This iterator goes through each blue node of the graph.
|
deba@1018
|
239 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
240 |
/// of blue nodes in a graph \c g of type \c %BpGraph like this:
|
deba@1018
|
241 |
///\code
|
deba@1018
|
242 |
/// int count=0;
|
deba@1018
|
243 |
/// for (BpGraph::BlueNodeIt n(g); n!=INVALID; ++n) ++count;
|
deba@1018
|
244 |
///\endcode
|
deba@1018
|
245 |
class BlueIt : public Node {
|
deba@1018
|
246 |
public:
|
deba@1018
|
247 |
/// Default constructor
|
deba@1018
|
248 |
|
deba@1018
|
249 |
/// Default constructor.
|
deba@1018
|
250 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
251 |
BlueIt() { }
|
deba@1018
|
252 |
/// Copy constructor.
|
deba@1018
|
253 |
|
deba@1018
|
254 |
/// Copy constructor.
|
deba@1018
|
255 |
///
|
deba@1018
|
256 |
BlueIt(const BlueIt& n) : Node(n) { }
|
deba@1018
|
257 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
258 |
|
deba@1018
|
259 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
260 |
/// \sa Invalid for more details.
|
deba@1018
|
261 |
BlueIt(Invalid) { }
|
deba@1018
|
262 |
/// Sets the iterator to the first blue node.
|
deba@1018
|
263 |
|
deba@1018
|
264 |
/// Sets the iterator to the first blue node of the given
|
deba@1018
|
265 |
/// digraph.
|
deba@1018
|
266 |
explicit BlueIt(const BpGraph&) { }
|
deba@1018
|
267 |
/// Sets the iterator to the given blue node.
|
deba@1018
|
268 |
|
deba@1018
|
269 |
/// Sets the iterator to the given blue node of the given
|
deba@1018
|
270 |
/// digraph.
|
deba@1018
|
271 |
BlueIt(const BpGraph&, const Node&) { }
|
deba@1018
|
272 |
/// Next node.
|
deba@1018
|
273 |
|
deba@1018
|
274 |
/// Assign the iterator to the next blue node.
|
deba@1018
|
275 |
///
|
deba@1018
|
276 |
BlueIt& operator++() { return *this; }
|
deba@1018
|
277 |
};
|
deba@1018
|
278 |
|
deba@1018
|
279 |
/// Iterator class for the nodes.
|
deba@1018
|
280 |
|
deba@1018
|
281 |
/// This iterator goes through each node of the graph.
|
deba@1018
|
282 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
283 |
/// of nodes in a graph \c g of type \c %BpGraph like this:
|
deba@1018
|
284 |
///\code
|
deba@1018
|
285 |
/// int count=0;
|
deba@1018
|
286 |
/// for (BpGraph::NodeIt n(g); n!=INVALID; ++n) ++count;
|
deba@1018
|
287 |
///\endcode
|
deba@1018
|
288 |
class NodeIt : public Node {
|
deba@1018
|
289 |
public:
|
deba@1018
|
290 |
/// Default constructor
|
deba@1018
|
291 |
|
deba@1018
|
292 |
/// Default constructor.
|
deba@1018
|
293 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
294 |
NodeIt() { }
|
deba@1018
|
295 |
/// Copy constructor.
|
deba@1018
|
296 |
|
deba@1018
|
297 |
/// Copy constructor.
|
deba@1018
|
298 |
///
|
deba@1018
|
299 |
NodeIt(const NodeIt& n) : Node(n) { }
|
deba@1018
|
300 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
301 |
|
deba@1018
|
302 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
303 |
/// \sa Invalid for more details.
|
deba@1018
|
304 |
NodeIt(Invalid) { }
|
deba@1018
|
305 |
/// Sets the iterator to the first node.
|
deba@1018
|
306 |
|
deba@1018
|
307 |
/// Sets the iterator to the first node of the given digraph.
|
deba@1018
|
308 |
///
|
deba@1018
|
309 |
explicit NodeIt(const BpGraph&) { }
|
deba@1018
|
310 |
/// Sets the iterator to the given node.
|
deba@1018
|
311 |
|
deba@1018
|
312 |
/// Sets the iterator to the given node of the given digraph.
|
deba@1018
|
313 |
///
|
deba@1018
|
314 |
NodeIt(const BpGraph&, const Node&) { }
|
deba@1018
|
315 |
/// Next node.
|
deba@1018
|
316 |
|
deba@1018
|
317 |
/// Assign the iterator to the next node.
|
deba@1018
|
318 |
///
|
deba@1018
|
319 |
NodeIt& operator++() { return *this; }
|
deba@1018
|
320 |
};
|
deba@1018
|
321 |
|
deba@1018
|
322 |
|
deba@1018
|
323 |
/// The edge type of the graph
|
deba@1018
|
324 |
|
deba@1018
|
325 |
/// This class identifies an edge of the graph. It also serves
|
deba@1018
|
326 |
/// as a base class of the edge iterators,
|
deba@1018
|
327 |
/// thus they will convert to this type.
|
deba@1018
|
328 |
class Edge {
|
deba@1018
|
329 |
public:
|
deba@1018
|
330 |
/// Default constructor
|
deba@1018
|
331 |
|
deba@1018
|
332 |
/// Default constructor.
|
deba@1018
|
333 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
334 |
Edge() { }
|
deba@1018
|
335 |
/// Copy constructor.
|
deba@1018
|
336 |
|
deba@1018
|
337 |
/// Copy constructor.
|
deba@1018
|
338 |
///
|
deba@1018
|
339 |
Edge(const Edge&) { }
|
deba@1018
|
340 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
341 |
|
deba@1018
|
342 |
/// Initializes the object to be invalid.
|
deba@1018
|
343 |
/// \sa Invalid for more details.
|
deba@1018
|
344 |
Edge(Invalid) { }
|
deba@1018
|
345 |
/// Equality operator
|
deba@1018
|
346 |
|
deba@1018
|
347 |
/// Equality operator.
|
deba@1018
|
348 |
///
|
deba@1018
|
349 |
/// Two iterators are equal if and only if they point to the
|
deba@1018
|
350 |
/// same object or both are \c INVALID.
|
deba@1018
|
351 |
bool operator==(Edge) const { return true; }
|
deba@1018
|
352 |
/// Inequality operator
|
deba@1018
|
353 |
|
deba@1018
|
354 |
/// Inequality operator.
|
deba@1018
|
355 |
bool operator!=(Edge) const { return true; }
|
deba@1018
|
356 |
|
deba@1018
|
357 |
/// Artificial ordering operator.
|
deba@1018
|
358 |
|
deba@1018
|
359 |
/// Artificial ordering operator.
|
deba@1018
|
360 |
///
|
deba@1018
|
361 |
/// \note This operator only has to define some strict ordering of
|
deba@1018
|
362 |
/// the edges; this order has nothing to do with the iteration
|
deba@1018
|
363 |
/// ordering of the edges.
|
deba@1018
|
364 |
bool operator<(Edge) const { return false; }
|
deba@1018
|
365 |
};
|
deba@1018
|
366 |
|
deba@1018
|
367 |
/// Iterator class for the edges.
|
deba@1018
|
368 |
|
deba@1018
|
369 |
/// This iterator goes through each edge of the graph.
|
deba@1018
|
370 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
371 |
/// of edges in a graph \c g of type \c %BpGraph as follows:
|
deba@1018
|
372 |
///\code
|
deba@1018
|
373 |
/// int count=0;
|
deba@1018
|
374 |
/// for(BpGraph::EdgeIt e(g); e!=INVALID; ++e) ++count;
|
deba@1018
|
375 |
///\endcode
|
deba@1018
|
376 |
class EdgeIt : public Edge {
|
deba@1018
|
377 |
public:
|
deba@1018
|
378 |
/// Default constructor
|
deba@1018
|
379 |
|
deba@1018
|
380 |
/// Default constructor.
|
deba@1018
|
381 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
382 |
EdgeIt() { }
|
deba@1018
|
383 |
/// Copy constructor.
|
deba@1018
|
384 |
|
deba@1018
|
385 |
/// Copy constructor.
|
deba@1018
|
386 |
///
|
deba@1018
|
387 |
EdgeIt(const EdgeIt& e) : Edge(e) { }
|
deba@1018
|
388 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
389 |
|
deba@1018
|
390 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
391 |
/// \sa Invalid for more details.
|
deba@1018
|
392 |
EdgeIt(Invalid) { }
|
deba@1018
|
393 |
/// Sets the iterator to the first edge.
|
deba@1018
|
394 |
|
deba@1018
|
395 |
/// Sets the iterator to the first edge of the given graph.
|
deba@1018
|
396 |
///
|
deba@1018
|
397 |
explicit EdgeIt(const BpGraph&) { }
|
deba@1018
|
398 |
/// Sets the iterator to the given edge.
|
deba@1018
|
399 |
|
deba@1018
|
400 |
/// Sets the iterator to the given edge of the given graph.
|
deba@1018
|
401 |
///
|
deba@1018
|
402 |
EdgeIt(const BpGraph&, const Edge&) { }
|
deba@1018
|
403 |
/// Next edge
|
deba@1018
|
404 |
|
deba@1018
|
405 |
/// Assign the iterator to the next edge.
|
deba@1018
|
406 |
///
|
deba@1018
|
407 |
EdgeIt& operator++() { return *this; }
|
deba@1018
|
408 |
};
|
deba@1018
|
409 |
|
deba@1018
|
410 |
/// Iterator class for the incident edges of a node.
|
deba@1018
|
411 |
|
deba@1018
|
412 |
/// This iterator goes trough the incident undirected edges
|
deba@1018
|
413 |
/// of a certain node of a graph.
|
deba@1018
|
414 |
/// Its usage is quite simple, for example, you can compute the
|
deba@1018
|
415 |
/// degree (i.e. the number of incident edges) of a node \c n
|
deba@1018
|
416 |
/// in a graph \c g of type \c %BpGraph as follows.
|
deba@1018
|
417 |
///
|
deba@1018
|
418 |
///\code
|
deba@1018
|
419 |
/// int count=0;
|
deba@1018
|
420 |
/// for(BpGraph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
|
deba@1018
|
421 |
///\endcode
|
deba@1018
|
422 |
///
|
deba@1018
|
423 |
/// \warning Loop edges will be iterated twice.
|
deba@1018
|
424 |
class IncEdgeIt : public Edge {
|
deba@1018
|
425 |
public:
|
deba@1018
|
426 |
/// Default constructor
|
deba@1018
|
427 |
|
deba@1018
|
428 |
/// Default constructor.
|
deba@1018
|
429 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
430 |
IncEdgeIt() { }
|
deba@1018
|
431 |
/// Copy constructor.
|
deba@1018
|
432 |
|
deba@1018
|
433 |
/// Copy constructor.
|
deba@1018
|
434 |
///
|
deba@1018
|
435 |
IncEdgeIt(const IncEdgeIt& e) : Edge(e) { }
|
deba@1018
|
436 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
437 |
|
deba@1018
|
438 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
439 |
/// \sa Invalid for more details.
|
deba@1018
|
440 |
IncEdgeIt(Invalid) { }
|
deba@1018
|
441 |
/// Sets the iterator to the first incident edge.
|
deba@1018
|
442 |
|
deba@1018
|
443 |
/// Sets the iterator to the first incident edge of the given node.
|
deba@1018
|
444 |
///
|
deba@1018
|
445 |
IncEdgeIt(const BpGraph&, const Node&) { }
|
deba@1018
|
446 |
/// Sets the iterator to the given edge.
|
deba@1018
|
447 |
|
deba@1018
|
448 |
/// Sets the iterator to the given edge of the given graph.
|
deba@1018
|
449 |
///
|
deba@1018
|
450 |
IncEdgeIt(const BpGraph&, const Edge&) { }
|
deba@1018
|
451 |
/// Next incident edge
|
deba@1018
|
452 |
|
deba@1018
|
453 |
/// Assign the iterator to the next incident edge
|
deba@1018
|
454 |
/// of the corresponding node.
|
deba@1018
|
455 |
IncEdgeIt& operator++() { return *this; }
|
deba@1018
|
456 |
};
|
deba@1018
|
457 |
|
deba@1018
|
458 |
/// The arc type of the graph
|
deba@1018
|
459 |
|
deba@1018
|
460 |
/// This class identifies a directed arc of the graph. It also serves
|
deba@1018
|
461 |
/// as a base class of the arc iterators,
|
deba@1018
|
462 |
/// thus they will convert to this type.
|
deba@1018
|
463 |
class Arc {
|
deba@1018
|
464 |
public:
|
deba@1018
|
465 |
/// Default constructor
|
deba@1018
|
466 |
|
deba@1018
|
467 |
/// Default constructor.
|
deba@1018
|
468 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
469 |
Arc() { }
|
deba@1018
|
470 |
/// Copy constructor.
|
deba@1018
|
471 |
|
deba@1018
|
472 |
/// Copy constructor.
|
deba@1018
|
473 |
///
|
deba@1018
|
474 |
Arc(const Arc&) { }
|
deba@1018
|
475 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
476 |
|
deba@1018
|
477 |
/// Initializes the object to be invalid.
|
deba@1018
|
478 |
/// \sa Invalid for more details.
|
deba@1018
|
479 |
Arc(Invalid) { }
|
deba@1018
|
480 |
/// Equality operator
|
deba@1018
|
481 |
|
deba@1018
|
482 |
/// Equality operator.
|
deba@1018
|
483 |
///
|
deba@1018
|
484 |
/// Two iterators are equal if and only if they point to the
|
deba@1018
|
485 |
/// same object or both are \c INVALID.
|
deba@1018
|
486 |
bool operator==(Arc) const { return true; }
|
deba@1018
|
487 |
/// Inequality operator
|
deba@1018
|
488 |
|
deba@1018
|
489 |
/// Inequality operator.
|
deba@1018
|
490 |
bool operator!=(Arc) const { return true; }
|
deba@1018
|
491 |
|
deba@1018
|
492 |
/// Artificial ordering operator.
|
deba@1018
|
493 |
|
deba@1018
|
494 |
/// Artificial ordering operator.
|
deba@1018
|
495 |
///
|
deba@1018
|
496 |
/// \note This operator only has to define some strict ordering of
|
deba@1018
|
497 |
/// the arcs; this order has nothing to do with the iteration
|
deba@1018
|
498 |
/// ordering of the arcs.
|
deba@1018
|
499 |
bool operator<(Arc) const { return false; }
|
deba@1018
|
500 |
|
deba@1018
|
501 |
/// Converison to \c Edge
|
deba@1018
|
502 |
|
deba@1018
|
503 |
/// Converison to \c Edge.
|
deba@1018
|
504 |
///
|
deba@1018
|
505 |
operator Edge() const { return Edge(); }
|
deba@1018
|
506 |
};
|
deba@1018
|
507 |
|
deba@1018
|
508 |
/// Iterator class for the arcs.
|
deba@1018
|
509 |
|
deba@1018
|
510 |
/// This iterator goes through each directed arc of the graph.
|
deba@1018
|
511 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
512 |
/// of arcs in a graph \c g of type \c %BpGraph as follows:
|
deba@1018
|
513 |
///\code
|
deba@1018
|
514 |
/// int count=0;
|
deba@1018
|
515 |
/// for(BpGraph::ArcIt a(g); a!=INVALID; ++a) ++count;
|
deba@1018
|
516 |
///\endcode
|
deba@1018
|
517 |
class ArcIt : public Arc {
|
deba@1018
|
518 |
public:
|
deba@1018
|
519 |
/// Default constructor
|
deba@1018
|
520 |
|
deba@1018
|
521 |
/// Default constructor.
|
deba@1018
|
522 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
523 |
ArcIt() { }
|
deba@1018
|
524 |
/// Copy constructor.
|
deba@1018
|
525 |
|
deba@1018
|
526 |
/// Copy constructor.
|
deba@1018
|
527 |
///
|
deba@1018
|
528 |
ArcIt(const ArcIt& e) : Arc(e) { }
|
deba@1018
|
529 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
530 |
|
deba@1018
|
531 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
532 |
/// \sa Invalid for more details.
|
deba@1018
|
533 |
ArcIt(Invalid) { }
|
deba@1018
|
534 |
/// Sets the iterator to the first arc.
|
deba@1018
|
535 |
|
deba@1018
|
536 |
/// Sets the iterator to the first arc of the given graph.
|
deba@1018
|
537 |
///
|
deba@1018
|
538 |
explicit ArcIt(const BpGraph &g) { ignore_unused_variable_warning(g); }
|
deba@1018
|
539 |
/// Sets the iterator to the given arc.
|
deba@1018
|
540 |
|
deba@1018
|
541 |
/// Sets the iterator to the given arc of the given graph.
|
deba@1018
|
542 |
///
|
deba@1018
|
543 |
ArcIt(const BpGraph&, const Arc&) { }
|
deba@1018
|
544 |
/// Next arc
|
deba@1018
|
545 |
|
deba@1018
|
546 |
/// Assign the iterator to the next arc.
|
deba@1018
|
547 |
///
|
deba@1018
|
548 |
ArcIt& operator++() { return *this; }
|
deba@1018
|
549 |
};
|
deba@1018
|
550 |
|
deba@1018
|
551 |
/// Iterator class for the outgoing arcs of a node.
|
deba@1018
|
552 |
|
deba@1018
|
553 |
/// This iterator goes trough the \e outgoing directed arcs of a
|
deba@1018
|
554 |
/// certain node of a graph.
|
deba@1018
|
555 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
556 |
/// of outgoing arcs of a node \c n
|
deba@1018
|
557 |
/// in a graph \c g of type \c %BpGraph as follows.
|
deba@1018
|
558 |
///\code
|
deba@1018
|
559 |
/// int count=0;
|
deba@1018
|
560 |
/// for (Digraph::OutArcIt a(g, n); a!=INVALID; ++a) ++count;
|
deba@1018
|
561 |
///\endcode
|
deba@1018
|
562 |
class OutArcIt : public Arc {
|
deba@1018
|
563 |
public:
|
deba@1018
|
564 |
/// Default constructor
|
deba@1018
|
565 |
|
deba@1018
|
566 |
/// Default constructor.
|
deba@1018
|
567 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
568 |
OutArcIt() { }
|
deba@1018
|
569 |
/// Copy constructor.
|
deba@1018
|
570 |
|
deba@1018
|
571 |
/// Copy constructor.
|
deba@1018
|
572 |
///
|
deba@1018
|
573 |
OutArcIt(const OutArcIt& e) : Arc(e) { }
|
deba@1018
|
574 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
575 |
|
deba@1018
|
576 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
577 |
/// \sa Invalid for more details.
|
deba@1018
|
578 |
OutArcIt(Invalid) { }
|
deba@1018
|
579 |
/// Sets the iterator to the first outgoing arc.
|
deba@1018
|
580 |
|
deba@1018
|
581 |
/// Sets the iterator to the first outgoing arc of the given node.
|
deba@1018
|
582 |
///
|
deba@1018
|
583 |
OutArcIt(const BpGraph& n, const Node& g) {
|
deba@1018
|
584 |
ignore_unused_variable_warning(n);
|
deba@1018
|
585 |
ignore_unused_variable_warning(g);
|
deba@1018
|
586 |
}
|
deba@1018
|
587 |
/// Sets the iterator to the given arc.
|
deba@1018
|
588 |
|
deba@1018
|
589 |
/// Sets the iterator to the given arc of the given graph.
|
deba@1018
|
590 |
///
|
deba@1018
|
591 |
OutArcIt(const BpGraph&, const Arc&) { }
|
deba@1018
|
592 |
/// Next outgoing arc
|
deba@1018
|
593 |
|
deba@1018
|
594 |
/// Assign the iterator to the next
|
deba@1018
|
595 |
/// outgoing arc of the corresponding node.
|
deba@1018
|
596 |
OutArcIt& operator++() { return *this; }
|
deba@1018
|
597 |
};
|
deba@1018
|
598 |
|
deba@1018
|
599 |
/// Iterator class for the incoming arcs of a node.
|
deba@1018
|
600 |
|
deba@1018
|
601 |
/// This iterator goes trough the \e incoming directed arcs of a
|
deba@1018
|
602 |
/// certain node of a graph.
|
deba@1018
|
603 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
604 |
/// of incoming arcs of a node \c n
|
deba@1018
|
605 |
/// in a graph \c g of type \c %BpGraph as follows.
|
deba@1018
|
606 |
///\code
|
deba@1018
|
607 |
/// int count=0;
|
deba@1018
|
608 |
/// for (Digraph::InArcIt a(g, n); a!=INVALID; ++a) ++count;
|
deba@1018
|
609 |
///\endcode
|
deba@1018
|
610 |
class InArcIt : public Arc {
|
deba@1018
|
611 |
public:
|
deba@1018
|
612 |
/// Default constructor
|
deba@1018
|
613 |
|
deba@1018
|
614 |
/// Default constructor.
|
deba@1018
|
615 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
616 |
InArcIt() { }
|
deba@1018
|
617 |
/// Copy constructor.
|
deba@1018
|
618 |
|
deba@1018
|
619 |
/// Copy constructor.
|
deba@1018
|
620 |
///
|
deba@1018
|
621 |
InArcIt(const InArcIt& e) : Arc(e) { }
|
deba@1018
|
622 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
623 |
|
deba@1018
|
624 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
625 |
/// \sa Invalid for more details.
|
deba@1018
|
626 |
InArcIt(Invalid) { }
|
deba@1018
|
627 |
/// Sets the iterator to the first incoming arc.
|
deba@1018
|
628 |
|
deba@1018
|
629 |
/// Sets the iterator to the first incoming arc of the given node.
|
deba@1018
|
630 |
///
|
deba@1018
|
631 |
InArcIt(const BpGraph& g, const Node& n) {
|
deba@1018
|
632 |
ignore_unused_variable_warning(n);
|
deba@1018
|
633 |
ignore_unused_variable_warning(g);
|
deba@1018
|
634 |
}
|
deba@1018
|
635 |
/// Sets the iterator to the given arc.
|
deba@1018
|
636 |
|
deba@1018
|
637 |
/// Sets the iterator to the given arc of the given graph.
|
deba@1018
|
638 |
///
|
deba@1018
|
639 |
InArcIt(const BpGraph&, const Arc&) { }
|
deba@1018
|
640 |
/// Next incoming arc
|
deba@1018
|
641 |
|
deba@1018
|
642 |
/// Assign the iterator to the next
|
deba@1018
|
643 |
/// incoming arc of the corresponding node.
|
deba@1018
|
644 |
InArcIt& operator++() { return *this; }
|
deba@1018
|
645 |
};
|
deba@1018
|
646 |
|
deba@1018
|
647 |
/// \brief Standard graph map type for the nodes.
|
deba@1018
|
648 |
///
|
deba@1018
|
649 |
/// Standard graph map type for the nodes.
|
deba@1018
|
650 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
651 |
template<class T>
|
deba@1018
|
652 |
class NodeMap : public ReferenceMap<Node, T, T&, const T&>
|
deba@1018
|
653 |
{
|
deba@1018
|
654 |
public:
|
deba@1018
|
655 |
|
deba@1018
|
656 |
/// Constructor
|
deba@1018
|
657 |
explicit NodeMap(const BpGraph&) { }
|
deba@1018
|
658 |
/// Constructor with given initial value
|
deba@1018
|
659 |
NodeMap(const BpGraph&, T) { }
|
deba@1018
|
660 |
|
deba@1018
|
661 |
private:
|
deba@1018
|
662 |
///Copy constructor
|
deba@1018
|
663 |
NodeMap(const NodeMap& nm) :
|
deba@1018
|
664 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
deba@1018
|
665 |
///Assignment operator
|
deba@1018
|
666 |
template <typename CMap>
|
deba@1018
|
667 |
NodeMap& operator=(const CMap&) {
|
deba@1018
|
668 |
checkConcept<ReadMap<Node, T>, CMap>();
|
deba@1018
|
669 |
return *this;
|
deba@1018
|
670 |
}
|
deba@1018
|
671 |
};
|
deba@1018
|
672 |
|
deba@1018
|
673 |
/// \brief Standard graph map type for the red nodes.
|
deba@1018
|
674 |
///
|
deba@1018
|
675 |
/// Standard graph map type for the red nodes.
|
deba@1018
|
676 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
677 |
template<class T>
|
deba@1018
|
678 |
class RedMap : public ReferenceMap<Node, T, T&, const T&>
|
deba@1018
|
679 |
{
|
deba@1018
|
680 |
public:
|
deba@1018
|
681 |
|
deba@1018
|
682 |
/// Constructor
|
deba@1018
|
683 |
explicit RedMap(const BpGraph&) { }
|
deba@1018
|
684 |
/// Constructor with given initial value
|
deba@1018
|
685 |
RedMap(const BpGraph&, T) { }
|
deba@1018
|
686 |
|
deba@1018
|
687 |
private:
|
deba@1018
|
688 |
///Copy constructor
|
deba@1018
|
689 |
RedMap(const RedMap& nm) :
|
deba@1018
|
690 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
deba@1018
|
691 |
///Assignment operator
|
deba@1018
|
692 |
template <typename CMap>
|
deba@1018
|
693 |
RedMap& operator=(const CMap&) {
|
deba@1018
|
694 |
checkConcept<ReadMap<Node, T>, CMap>();
|
deba@1018
|
695 |
return *this;
|
deba@1018
|
696 |
}
|
deba@1018
|
697 |
};
|
deba@1018
|
698 |
|
deba@1018
|
699 |
/// \brief Standard graph map type for the blue nodes.
|
deba@1018
|
700 |
///
|
deba@1018
|
701 |
/// Standard graph map type for the blue nodes.
|
deba@1018
|
702 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
703 |
template<class T>
|
deba@1018
|
704 |
class BlueMap : public ReferenceMap<Node, T, T&, const T&>
|
deba@1018
|
705 |
{
|
deba@1018
|
706 |
public:
|
deba@1018
|
707 |
|
deba@1018
|
708 |
/// Constructor
|
deba@1018
|
709 |
explicit BlueMap(const BpGraph&) { }
|
deba@1018
|
710 |
/// Constructor with given initial value
|
deba@1018
|
711 |
BlueMap(const BpGraph&, T) { }
|
deba@1018
|
712 |
|
deba@1018
|
713 |
private:
|
deba@1018
|
714 |
///Copy constructor
|
deba@1018
|
715 |
BlueMap(const BlueMap& nm) :
|
deba@1018
|
716 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
deba@1018
|
717 |
///Assignment operator
|
deba@1018
|
718 |
template <typename CMap>
|
deba@1018
|
719 |
BlueMap& operator=(const CMap&) {
|
deba@1018
|
720 |
checkConcept<ReadMap<Node, T>, CMap>();
|
deba@1018
|
721 |
return *this;
|
deba@1018
|
722 |
}
|
deba@1018
|
723 |
};
|
deba@1018
|
724 |
|
deba@1018
|
725 |
/// \brief Standard graph map type for the arcs.
|
deba@1018
|
726 |
///
|
deba@1018
|
727 |
/// Standard graph map type for the arcs.
|
deba@1018
|
728 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
729 |
template<class T>
|
deba@1018
|
730 |
class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
|
deba@1018
|
731 |
{
|
deba@1018
|
732 |
public:
|
deba@1018
|
733 |
|
deba@1018
|
734 |
/// Constructor
|
deba@1018
|
735 |
explicit ArcMap(const BpGraph&) { }
|
deba@1018
|
736 |
/// Constructor with given initial value
|
deba@1018
|
737 |
ArcMap(const BpGraph&, T) { }
|
deba@1018
|
738 |
|
deba@1018
|
739 |
private:
|
deba@1018
|
740 |
///Copy constructor
|
deba@1018
|
741 |
ArcMap(const ArcMap& em) :
|
deba@1018
|
742 |
ReferenceMap<Arc, T, T&, const T&>(em) { }
|
deba@1018
|
743 |
///Assignment operator
|
deba@1018
|
744 |
template <typename CMap>
|
deba@1018
|
745 |
ArcMap& operator=(const CMap&) {
|
deba@1018
|
746 |
checkConcept<ReadMap<Arc, T>, CMap>();
|
deba@1018
|
747 |
return *this;
|
deba@1018
|
748 |
}
|
deba@1018
|
749 |
};
|
deba@1018
|
750 |
|
deba@1018
|
751 |
/// \brief Standard graph map type for the edges.
|
deba@1018
|
752 |
///
|
deba@1018
|
753 |
/// Standard graph map type for the edges.
|
deba@1018
|
754 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
755 |
template<class T>
|
deba@1018
|
756 |
class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
|
deba@1018
|
757 |
{
|
deba@1018
|
758 |
public:
|
deba@1018
|
759 |
|
deba@1018
|
760 |
/// Constructor
|
deba@1018
|
761 |
explicit EdgeMap(const BpGraph&) { }
|
deba@1018
|
762 |
/// Constructor with given initial value
|
deba@1018
|
763 |
EdgeMap(const BpGraph&, T) { }
|
deba@1018
|
764 |
|
deba@1018
|
765 |
private:
|
deba@1018
|
766 |
///Copy constructor
|
deba@1018
|
767 |
EdgeMap(const EdgeMap& em) :
|
deba@1018
|
768 |
ReferenceMap<Edge, T, T&, const T&>(em) {}
|
deba@1018
|
769 |
///Assignment operator
|
deba@1018
|
770 |
template <typename CMap>
|
deba@1018
|
771 |
EdgeMap& operator=(const CMap&) {
|
deba@1018
|
772 |
checkConcept<ReadMap<Edge, T>, CMap>();
|
deba@1018
|
773 |
return *this;
|
deba@1018
|
774 |
}
|
deba@1018
|
775 |
};
|
deba@1018
|
776 |
|
deba@1018
|
777 |
/// \brief Gives back %true for red nodes.
|
deba@1018
|
778 |
///
|
deba@1018
|
779 |
/// Gives back %true for red nodes.
|
deba@1018
|
780 |
bool red(const Node&) const { return true; }
|
deba@1018
|
781 |
|
deba@1018
|
782 |
/// \brief Gives back %true for blue nodes.
|
deba@1018
|
783 |
///
|
deba@1018
|
784 |
/// Gives back %true for blue nodes.
|
deba@1018
|
785 |
bool blue(const Node&) const { return true; }
|
deba@1018
|
786 |
|
deba@1018
|
787 |
/// \brief Gives back the red end node of the edge.
|
deba@1018
|
788 |
///
|
deba@1018
|
789 |
/// Gives back the red end node of the edge.
|
deba@1018
|
790 |
Node redNode(const Edge&) const { return Node(); }
|
deba@1018
|
791 |
|
deba@1018
|
792 |
/// \brief Gives back the blue end node of the edge.
|
deba@1018
|
793 |
///
|
deba@1018
|
794 |
/// Gives back the blue end node of the edge.
|
deba@1018
|
795 |
Node blueNode(const Edge&) const { return Node(); }
|
deba@1018
|
796 |
|
deba@1018
|
797 |
/// \brief The first node of the edge.
|
deba@1018
|
798 |
///
|
deba@1018
|
799 |
/// It is a synonim for the \c redNode().
|
deba@1018
|
800 |
Node u(Edge) const { return INVALID; }
|
deba@1018
|
801 |
|
deba@1018
|
802 |
/// \brief The second node of the edge.
|
deba@1018
|
803 |
///
|
deba@1018
|
804 |
/// It is a synonim for the \c blueNode().
|
deba@1018
|
805 |
Node v(Edge) const { return INVALID; }
|
deba@1018
|
806 |
|
deba@1018
|
807 |
/// \brief The source node of the arc.
|
deba@1018
|
808 |
///
|
deba@1018
|
809 |
/// Returns the source node of the given arc.
|
deba@1018
|
810 |
Node source(Arc) const { return INVALID; }
|
deba@1018
|
811 |
|
deba@1018
|
812 |
/// \brief The target node of the arc.
|
deba@1018
|
813 |
///
|
deba@1018
|
814 |
/// Returns the target node of the given arc.
|
deba@1018
|
815 |
Node target(Arc) const { return INVALID; }
|
deba@1018
|
816 |
|
deba@1018
|
817 |
/// \brief The ID of the node.
|
deba@1018
|
818 |
///
|
deba@1018
|
819 |
/// Returns the ID of the given node.
|
deba@1018
|
820 |
int id(Node) const { return -1; }
|
deba@1018
|
821 |
|
deba@1018
|
822 |
/// \brief The red ID of the node.
|
deba@1018
|
823 |
///
|
deba@1018
|
824 |
/// Returns the red ID of the given node.
|
deba@1018
|
825 |
int redId(Node) const { return -1; }
|
deba@1018
|
826 |
|
deba@1018
|
827 |
/// \brief The red ID of the node.
|
deba@1018
|
828 |
///
|
deba@1018
|
829 |
/// Returns the red ID of the given node.
|
deba@1018
|
830 |
int id(RedNode) const { return -1; }
|
deba@1018
|
831 |
|
deba@1018
|
832 |
/// \brief The blue ID of the node.
|
deba@1018
|
833 |
///
|
deba@1018
|
834 |
/// Returns the blue ID of the given node.
|
deba@1018
|
835 |
int blueId(Node) const { return -1; }
|
deba@1018
|
836 |
|
deba@1018
|
837 |
/// \brief The blue ID of the node.
|
deba@1018
|
838 |
///
|
deba@1018
|
839 |
/// Returns the blue ID of the given node.
|
deba@1018
|
840 |
int id(BlueNode) const { return -1; }
|
deba@1018
|
841 |
|
deba@1018
|
842 |
/// \brief The ID of the edge.
|
deba@1018
|
843 |
///
|
deba@1018
|
844 |
/// Returns the ID of the given edge.
|
deba@1018
|
845 |
int id(Edge) const { return -1; }
|
deba@1018
|
846 |
|
deba@1018
|
847 |
/// \brief The ID of the arc.
|
deba@1018
|
848 |
///
|
deba@1018
|
849 |
/// Returns the ID of the given arc.
|
deba@1018
|
850 |
int id(Arc) const { return -1; }
|
deba@1018
|
851 |
|
deba@1018
|
852 |
/// \brief The node with the given ID.
|
deba@1018
|
853 |
///
|
deba@1018
|
854 |
/// Returns the node with the given ID.
|
deba@1018
|
855 |
/// \pre The argument should be a valid node ID in the graph.
|
deba@1018
|
856 |
Node nodeFromId(int) const { return INVALID; }
|
deba@1018
|
857 |
|
deba@1018
|
858 |
/// \brief The edge with the given ID.
|
deba@1018
|
859 |
///
|
deba@1018
|
860 |
/// Returns the edge with the given ID.
|
deba@1018
|
861 |
/// \pre The argument should be a valid edge ID in the graph.
|
deba@1018
|
862 |
Edge edgeFromId(int) const { return INVALID; }
|
deba@1018
|
863 |
|
deba@1018
|
864 |
/// \brief The arc with the given ID.
|
deba@1018
|
865 |
///
|
deba@1018
|
866 |
/// Returns the arc with the given ID.
|
deba@1018
|
867 |
/// \pre The argument should be a valid arc ID in the graph.
|
deba@1018
|
868 |
Arc arcFromId(int) const { return INVALID; }
|
deba@1018
|
869 |
|
deba@1018
|
870 |
/// \brief An upper bound on the node IDs.
|
deba@1018
|
871 |
///
|
deba@1018
|
872 |
/// Returns an upper bound on the node IDs.
|
deba@1018
|
873 |
int maxNodeId() const { return -1; }
|
deba@1018
|
874 |
|
deba@1018
|
875 |
/// \brief An upper bound on the red IDs.
|
deba@1018
|
876 |
///
|
deba@1018
|
877 |
/// Returns an upper bound on the red IDs.
|
deba@1018
|
878 |
int maxRedId() const { return -1; }
|
deba@1018
|
879 |
|
deba@1018
|
880 |
/// \brief An upper bound on the blue IDs.
|
deba@1018
|
881 |
///
|
deba@1018
|
882 |
/// Returns an upper bound on the blue IDs.
|
deba@1018
|
883 |
int maxBlueId() const { return -1; }
|
deba@1018
|
884 |
|
deba@1018
|
885 |
/// \brief An upper bound on the edge IDs.
|
deba@1018
|
886 |
///
|
deba@1018
|
887 |
/// Returns an upper bound on the edge IDs.
|
deba@1018
|
888 |
int maxEdgeId() const { return -1; }
|
deba@1018
|
889 |
|
deba@1018
|
890 |
/// \brief An upper bound on the arc IDs.
|
deba@1018
|
891 |
///
|
deba@1018
|
892 |
/// Returns an upper bound on the arc IDs.
|
deba@1018
|
893 |
int maxArcId() const { return -1; }
|
deba@1018
|
894 |
|
deba@1018
|
895 |
/// \brief The direction of the arc.
|
deba@1018
|
896 |
///
|
deba@1018
|
897 |
/// Returns \c true if the given arc goes from a red node to a blue node.
|
deba@1018
|
898 |
bool direction(Arc) const { return true; }
|
deba@1018
|
899 |
|
deba@1018
|
900 |
/// \brief Direct the edge.
|
deba@1018
|
901 |
///
|
deba@1018
|
902 |
/// Direct the given edge. The returned arc
|
deba@1018
|
903 |
/// represents the given edge and its direction comes
|
deba@1018
|
904 |
/// from the bool parameter. If it is \c true, then the source of the node
|
deba@1018
|
905 |
/// will be a red node.
|
deba@1018
|
906 |
Arc direct(Edge, bool) const {
|
deba@1018
|
907 |
return INVALID;
|
deba@1018
|
908 |
}
|
deba@1018
|
909 |
|
deba@1018
|
910 |
/// \brief Direct the edge.
|
deba@1018
|
911 |
///
|
deba@1018
|
912 |
/// Direct the given edge. The returned arc represents the given
|
deba@1018
|
913 |
/// edge and its source node is the given node.
|
deba@1018
|
914 |
Arc direct(Edge, Node) const {
|
deba@1018
|
915 |
return INVALID;
|
deba@1018
|
916 |
}
|
deba@1018
|
917 |
|
deba@1018
|
918 |
/// \brief The oppositely directed arc.
|
deba@1018
|
919 |
///
|
deba@1018
|
920 |
/// Returns the oppositely directed arc representing the same edge.
|
deba@1018
|
921 |
Arc oppositeArc(Arc) const { return INVALID; }
|
deba@1018
|
922 |
|
deba@1018
|
923 |
/// \brief The opposite node on the edge.
|
deba@1018
|
924 |
///
|
deba@1018
|
925 |
/// Returns the opposite node on the given edge.
|
deba@1018
|
926 |
Node oppositeNode(Node, Edge) const { return INVALID; }
|
deba@1018
|
927 |
|
deba@1018
|
928 |
void first(Node&) const {}
|
deba@1018
|
929 |
void next(Node&) const {}
|
deba@1018
|
930 |
|
deba@1018
|
931 |
void firstRed(Node&) const {}
|
deba@1018
|
932 |
void nextRed(Node&) const {}
|
deba@1018
|
933 |
|
deba@1018
|
934 |
void firstBlue(Node&) const {}
|
deba@1018
|
935 |
void nextBlue(Node&) const {}
|
deba@1018
|
936 |
|
deba@1018
|
937 |
void first(Edge&) const {}
|
deba@1018
|
938 |
void next(Edge&) const {}
|
deba@1018
|
939 |
|
deba@1018
|
940 |
void first(Arc&) const {}
|
deba@1018
|
941 |
void next(Arc&) const {}
|
deba@1018
|
942 |
|
deba@1018
|
943 |
void firstOut(Arc&, Node) const {}
|
deba@1018
|
944 |
void nextOut(Arc&) const {}
|
deba@1018
|
945 |
|
deba@1018
|
946 |
void firstIn(Arc&, Node) const {}
|
deba@1018
|
947 |
void nextIn(Arc&) const {}
|
deba@1018
|
948 |
|
deba@1018
|
949 |
void firstInc(Edge &, bool &, const Node &) const {}
|
deba@1018
|
950 |
void nextInc(Edge &, bool &) const {}
|
deba@1018
|
951 |
|
deba@1018
|
952 |
// The second parameter is dummy.
|
deba@1018
|
953 |
Node fromId(int, Node) const { return INVALID; }
|
deba@1018
|
954 |
// The second parameter is dummy.
|
deba@1018
|
955 |
Edge fromId(int, Edge) const { return INVALID; }
|
deba@1018
|
956 |
// The second parameter is dummy.
|
deba@1018
|
957 |
Arc fromId(int, Arc) const { return INVALID; }
|
deba@1018
|
958 |
|
deba@1018
|
959 |
// Dummy parameter.
|
deba@1018
|
960 |
int maxId(Node) const { return -1; }
|
deba@1018
|
961 |
// Dummy parameter.
|
deba@1018
|
962 |
int maxId(RedNode) const { return -1; }
|
deba@1018
|
963 |
// Dummy parameter.
|
deba@1018
|
964 |
int maxId(BlueNode) const { return -1; }
|
deba@1018
|
965 |
// Dummy parameter.
|
deba@1018
|
966 |
int maxId(Edge) const { return -1; }
|
deba@1018
|
967 |
// Dummy parameter.
|
deba@1018
|
968 |
int maxId(Arc) const { return -1; }
|
deba@1018
|
969 |
|
deba@1018
|
970 |
/// \brief The base node of the iterator.
|
deba@1018
|
971 |
///
|
deba@1018
|
972 |
/// Returns the base node of the given incident edge iterator.
|
deba@1018
|
973 |
Node baseNode(IncEdgeIt) const { return INVALID; }
|
deba@1018
|
974 |
|
deba@1018
|
975 |
/// \brief The running node of the iterator.
|
deba@1018
|
976 |
///
|
deba@1018
|
977 |
/// Returns the running node of the given incident edge iterator.
|
deba@1018
|
978 |
Node runningNode(IncEdgeIt) const { return INVALID; }
|
deba@1018
|
979 |
|
deba@1018
|
980 |
/// \brief The base node of the iterator.
|
deba@1018
|
981 |
///
|
deba@1018
|
982 |
/// Returns the base node of the given outgoing arc iterator
|
deba@1018
|
983 |
/// (i.e. the source node of the corresponding arc).
|
deba@1018
|
984 |
Node baseNode(OutArcIt) const { return INVALID; }
|
deba@1018
|
985 |
|
deba@1018
|
986 |
/// \brief The running node of the iterator.
|
deba@1018
|
987 |
///
|
deba@1018
|
988 |
/// Returns the running node of the given outgoing arc iterator
|
deba@1018
|
989 |
/// (i.e. the target node of the corresponding arc).
|
deba@1018
|
990 |
Node runningNode(OutArcIt) const { return INVALID; }
|
deba@1018
|
991 |
|
deba@1018
|
992 |
/// \brief The base node of the iterator.
|
deba@1018
|
993 |
///
|
deba@1018
|
994 |
/// Returns the base node of the given incomming arc iterator
|
deba@1018
|
995 |
/// (i.e. the target node of the corresponding arc).
|
deba@1018
|
996 |
Node baseNode(InArcIt) const { return INVALID; }
|
deba@1018
|
997 |
|
deba@1018
|
998 |
/// \brief The running node of the iterator.
|
deba@1018
|
999 |
///
|
deba@1018
|
1000 |
/// Returns the running node of the given incomming arc iterator
|
deba@1018
|
1001 |
/// (i.e. the source node of the corresponding arc).
|
deba@1018
|
1002 |
Node runningNode(InArcIt) const { return INVALID; }
|
deba@1018
|
1003 |
|
deba@1018
|
1004 |
template <typename _BpGraph>
|
deba@1018
|
1005 |
struct Constraints {
|
deba@1018
|
1006 |
void constraints() {
|
deba@1018
|
1007 |
checkConcept<BaseBpGraphComponent, _BpGraph>();
|
deba@1018
|
1008 |
checkConcept<IterableBpGraphComponent<>, _BpGraph>();
|
deba@1018
|
1009 |
checkConcept<IDableBpGraphComponent<>, _BpGraph>();
|
deba@1018
|
1010 |
checkConcept<MappableBpGraphComponent<>, _BpGraph>();
|
deba@1018
|
1011 |
}
|
deba@1018
|
1012 |
};
|
deba@1018
|
1013 |
|
deba@1018
|
1014 |
};
|
deba@1018
|
1015 |
|
deba@1018
|
1016 |
}
|
deba@1018
|
1017 |
|
deba@1018
|
1018 |
}
|
deba@1018
|
1019 |
|
deba@1018
|
1020 |
#endif
|