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 |
*
|
alpar@1092
|
5 |
* Copyright (C) 2003-2013
|
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@1026
|
51 |
/// nodes can be iterated with the RedNodeIt and BlueNodeIt in the
|
deba@1026
|
52 |
/// two node sets. With RedNodeMap and BlueNodeMap values can be
|
deba@1026
|
53 |
/// assigned to 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 |
};
|
deba@1018
|
153 |
|
deba@1018
|
154 |
/// Class to represent blue nodes.
|
deba@1018
|
155 |
|
deba@1018
|
156 |
/// This class represents the blue nodes of the graph. It does
|
deba@1018
|
157 |
/// not supposed to be used directly, because the nodes can be
|
deba@1018
|
158 |
/// represented as Node instances. This class can be used as
|
deba@1018
|
159 |
/// template parameter for special map classes.
|
deba@1018
|
160 |
class BlueNode : public Node {
|
deba@1018
|
161 |
public:
|
deba@1018
|
162 |
/// Default constructor
|
deba@1018
|
163 |
|
deba@1018
|
164 |
/// Default constructor.
|
deba@1018
|
165 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
166 |
BlueNode() { }
|
deba@1018
|
167 |
/// Copy constructor.
|
deba@1018
|
168 |
|
deba@1018
|
169 |
/// Copy constructor.
|
deba@1018
|
170 |
///
|
deba@1018
|
171 |
BlueNode(const BlueNode&) : Node() { }
|
deba@1018
|
172 |
|
deba@1018
|
173 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
174 |
|
deba@1018
|
175 |
/// Initializes the object to be invalid.
|
deba@1018
|
176 |
/// \sa Invalid for more details.
|
deba@1018
|
177 |
BlueNode(Invalid) { }
|
deba@1018
|
178 |
|
deba@1018
|
179 |
};
|
deba@1018
|
180 |
|
deba@1018
|
181 |
/// Iterator class for the red nodes.
|
deba@1018
|
182 |
|
deba@1018
|
183 |
/// This iterator goes through each red node of the graph.
|
deba@1018
|
184 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
185 |
/// of red nodes in a graph \c g of type \c %BpGraph like this:
|
deba@1018
|
186 |
///\code
|
deba@1018
|
187 |
/// int count=0;
|
deba@1018
|
188 |
/// for (BpGraph::RedNodeIt n(g); n!=INVALID; ++n) ++count;
|
deba@1018
|
189 |
///\endcode
|
deba@1026
|
190 |
class RedNodeIt : public RedNode {
|
deba@1018
|
191 |
public:
|
deba@1018
|
192 |
/// Default constructor
|
deba@1018
|
193 |
|
deba@1018
|
194 |
/// Default constructor.
|
deba@1018
|
195 |
/// \warning It sets the iterator to an undefined value.
|
deba@1026
|
196 |
RedNodeIt() { }
|
deba@1018
|
197 |
/// Copy constructor.
|
deba@1018
|
198 |
|
deba@1018
|
199 |
/// Copy constructor.
|
deba@1018
|
200 |
///
|
deba@1026
|
201 |
RedNodeIt(const RedNodeIt& n) : RedNode(n) { }
|
deba@1018
|
202 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
203 |
|
deba@1018
|
204 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
205 |
/// \sa Invalid for more details.
|
deba@1026
|
206 |
RedNodeIt(Invalid) { }
|
deba@1018
|
207 |
/// Sets the iterator to the first red node.
|
deba@1018
|
208 |
|
deba@1018
|
209 |
/// Sets the iterator to the first red node of the given
|
deba@1018
|
210 |
/// digraph.
|
deba@1026
|
211 |
explicit RedNodeIt(const BpGraph&) { }
|
deba@1018
|
212 |
/// Sets the iterator to the given red node.
|
deba@1018
|
213 |
|
deba@1018
|
214 |
/// Sets the iterator to the given red node of the given
|
deba@1018
|
215 |
/// digraph.
|
deba@1026
|
216 |
RedNodeIt(const BpGraph&, const RedNode&) { }
|
deba@1018
|
217 |
/// Next node.
|
deba@1018
|
218 |
|
deba@1018
|
219 |
/// Assign the iterator to the next red node.
|
deba@1018
|
220 |
///
|
deba@1026
|
221 |
RedNodeIt& operator++() { return *this; }
|
deba@1018
|
222 |
};
|
deba@1018
|
223 |
|
deba@1018
|
224 |
/// Iterator class for the blue nodes.
|
deba@1018
|
225 |
|
deba@1018
|
226 |
/// This iterator goes through each blue node of the graph.
|
deba@1018
|
227 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
228 |
/// of blue nodes in a graph \c g of type \c %BpGraph like this:
|
deba@1018
|
229 |
///\code
|
deba@1018
|
230 |
/// int count=0;
|
deba@1018
|
231 |
/// for (BpGraph::BlueNodeIt n(g); n!=INVALID; ++n) ++count;
|
deba@1018
|
232 |
///\endcode
|
deba@1026
|
233 |
class BlueNodeIt : public BlueNode {
|
deba@1018
|
234 |
public:
|
deba@1018
|
235 |
/// Default constructor
|
deba@1018
|
236 |
|
deba@1018
|
237 |
/// Default constructor.
|
deba@1018
|
238 |
/// \warning It sets the iterator to an undefined value.
|
deba@1026
|
239 |
BlueNodeIt() { }
|
deba@1018
|
240 |
/// Copy constructor.
|
deba@1018
|
241 |
|
deba@1018
|
242 |
/// Copy constructor.
|
deba@1018
|
243 |
///
|
deba@1026
|
244 |
BlueNodeIt(const BlueNodeIt& n) : BlueNode(n) { }
|
deba@1018
|
245 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
246 |
|
deba@1018
|
247 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
248 |
/// \sa Invalid for more details.
|
deba@1026
|
249 |
BlueNodeIt(Invalid) { }
|
deba@1018
|
250 |
/// Sets the iterator to the first blue node.
|
deba@1018
|
251 |
|
deba@1018
|
252 |
/// Sets the iterator to the first blue node of the given
|
deba@1018
|
253 |
/// digraph.
|
deba@1026
|
254 |
explicit BlueNodeIt(const BpGraph&) { }
|
deba@1018
|
255 |
/// Sets the iterator to the given blue node.
|
deba@1018
|
256 |
|
deba@1018
|
257 |
/// Sets the iterator to the given blue node of the given
|
deba@1018
|
258 |
/// digraph.
|
deba@1026
|
259 |
BlueNodeIt(const BpGraph&, const BlueNode&) { }
|
deba@1018
|
260 |
/// Next node.
|
deba@1018
|
261 |
|
deba@1018
|
262 |
/// Assign the iterator to the next blue node.
|
deba@1018
|
263 |
///
|
deba@1026
|
264 |
BlueNodeIt& operator++() { return *this; }
|
deba@1018
|
265 |
};
|
deba@1018
|
266 |
|
deba@1018
|
267 |
/// Iterator class for the nodes.
|
deba@1018
|
268 |
|
deba@1018
|
269 |
/// This iterator goes through each node of the graph.
|
deba@1018
|
270 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
271 |
/// of nodes in a graph \c g of type \c %BpGraph like this:
|
deba@1018
|
272 |
///\code
|
deba@1018
|
273 |
/// int count=0;
|
deba@1018
|
274 |
/// for (BpGraph::NodeIt n(g); n!=INVALID; ++n) ++count;
|
deba@1018
|
275 |
///\endcode
|
deba@1018
|
276 |
class NodeIt : public Node {
|
deba@1018
|
277 |
public:
|
deba@1018
|
278 |
/// Default constructor
|
deba@1018
|
279 |
|
deba@1018
|
280 |
/// Default constructor.
|
deba@1018
|
281 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
282 |
NodeIt() { }
|
deba@1018
|
283 |
/// Copy constructor.
|
deba@1018
|
284 |
|
deba@1018
|
285 |
/// Copy constructor.
|
deba@1018
|
286 |
///
|
deba@1018
|
287 |
NodeIt(const NodeIt& n) : Node(n) { }
|
deba@1018
|
288 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
289 |
|
deba@1018
|
290 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
291 |
/// \sa Invalid for more details.
|
deba@1018
|
292 |
NodeIt(Invalid) { }
|
deba@1018
|
293 |
/// Sets the iterator to the first node.
|
deba@1018
|
294 |
|
deba@1018
|
295 |
/// Sets the iterator to the first node of the given digraph.
|
deba@1018
|
296 |
///
|
deba@1018
|
297 |
explicit NodeIt(const BpGraph&) { }
|
deba@1018
|
298 |
/// Sets the iterator to the given node.
|
deba@1018
|
299 |
|
deba@1018
|
300 |
/// Sets the iterator to the given node of the given digraph.
|
deba@1018
|
301 |
///
|
deba@1018
|
302 |
NodeIt(const BpGraph&, const Node&) { }
|
deba@1018
|
303 |
/// Next node.
|
deba@1018
|
304 |
|
deba@1018
|
305 |
/// Assign the iterator to the next node.
|
deba@1018
|
306 |
///
|
deba@1018
|
307 |
NodeIt& operator++() { return *this; }
|
deba@1018
|
308 |
};
|
deba@1018
|
309 |
|
deba@1018
|
310 |
|
deba@1018
|
311 |
/// The edge type of the graph
|
deba@1018
|
312 |
|
deba@1018
|
313 |
/// This class identifies an edge of the graph. It also serves
|
deba@1018
|
314 |
/// as a base class of the edge iterators,
|
deba@1018
|
315 |
/// thus they will convert to this type.
|
deba@1018
|
316 |
class Edge {
|
deba@1018
|
317 |
public:
|
deba@1018
|
318 |
/// Default constructor
|
deba@1018
|
319 |
|
deba@1018
|
320 |
/// Default constructor.
|
deba@1018
|
321 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
322 |
Edge() { }
|
deba@1018
|
323 |
/// Copy constructor.
|
deba@1018
|
324 |
|
deba@1018
|
325 |
/// Copy constructor.
|
deba@1018
|
326 |
///
|
deba@1018
|
327 |
Edge(const Edge&) { }
|
deba@1018
|
328 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
329 |
|
deba@1018
|
330 |
/// Initializes the object to be invalid.
|
deba@1018
|
331 |
/// \sa Invalid for more details.
|
deba@1018
|
332 |
Edge(Invalid) { }
|
deba@1018
|
333 |
/// Equality operator
|
deba@1018
|
334 |
|
deba@1018
|
335 |
/// Equality operator.
|
deba@1018
|
336 |
///
|
deba@1018
|
337 |
/// Two iterators are equal if and only if they point to the
|
deba@1018
|
338 |
/// same object or both are \c INVALID.
|
deba@1018
|
339 |
bool operator==(Edge) const { return true; }
|
deba@1018
|
340 |
/// Inequality operator
|
deba@1018
|
341 |
|
deba@1018
|
342 |
/// Inequality operator.
|
deba@1018
|
343 |
bool operator!=(Edge) const { return true; }
|
deba@1018
|
344 |
|
deba@1018
|
345 |
/// Artificial ordering operator.
|
deba@1018
|
346 |
|
deba@1018
|
347 |
/// Artificial ordering operator.
|
deba@1018
|
348 |
///
|
deba@1018
|
349 |
/// \note This operator only has to define some strict ordering of
|
deba@1018
|
350 |
/// the edges; this order has nothing to do with the iteration
|
deba@1018
|
351 |
/// ordering of the edges.
|
deba@1018
|
352 |
bool operator<(Edge) const { return false; }
|
deba@1018
|
353 |
};
|
deba@1018
|
354 |
|
deba@1018
|
355 |
/// Iterator class for the edges.
|
deba@1018
|
356 |
|
deba@1018
|
357 |
/// This iterator goes through each edge of the graph.
|
deba@1018
|
358 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
359 |
/// of edges in a graph \c g of type \c %BpGraph as follows:
|
deba@1018
|
360 |
///\code
|
deba@1018
|
361 |
/// int count=0;
|
deba@1018
|
362 |
/// for(BpGraph::EdgeIt e(g); e!=INVALID; ++e) ++count;
|
deba@1018
|
363 |
///\endcode
|
deba@1018
|
364 |
class EdgeIt : public Edge {
|
deba@1018
|
365 |
public:
|
deba@1018
|
366 |
/// Default constructor
|
deba@1018
|
367 |
|
deba@1018
|
368 |
/// Default constructor.
|
deba@1018
|
369 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
370 |
EdgeIt() { }
|
deba@1018
|
371 |
/// Copy constructor.
|
deba@1018
|
372 |
|
deba@1018
|
373 |
/// Copy constructor.
|
deba@1018
|
374 |
///
|
deba@1018
|
375 |
EdgeIt(const EdgeIt& e) : Edge(e) { }
|
deba@1018
|
376 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
377 |
|
deba@1018
|
378 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
379 |
/// \sa Invalid for more details.
|
deba@1018
|
380 |
EdgeIt(Invalid) { }
|
deba@1018
|
381 |
/// Sets the iterator to the first edge.
|
deba@1018
|
382 |
|
deba@1018
|
383 |
/// Sets the iterator to the first edge of the given graph.
|
deba@1018
|
384 |
///
|
deba@1018
|
385 |
explicit EdgeIt(const BpGraph&) { }
|
deba@1018
|
386 |
/// Sets the iterator to the given edge.
|
deba@1018
|
387 |
|
deba@1018
|
388 |
/// Sets the iterator to the given edge of the given graph.
|
deba@1018
|
389 |
///
|
deba@1018
|
390 |
EdgeIt(const BpGraph&, const Edge&) { }
|
deba@1018
|
391 |
/// Next edge
|
deba@1018
|
392 |
|
deba@1018
|
393 |
/// Assign the iterator to the next edge.
|
deba@1018
|
394 |
///
|
deba@1018
|
395 |
EdgeIt& operator++() { return *this; }
|
deba@1018
|
396 |
};
|
deba@1018
|
397 |
|
deba@1018
|
398 |
/// Iterator class for the incident edges of a node.
|
deba@1018
|
399 |
|
deba@1018
|
400 |
/// This iterator goes trough the incident undirected edges
|
deba@1018
|
401 |
/// of a certain node of a graph.
|
deba@1018
|
402 |
/// Its usage is quite simple, for example, you can compute the
|
deba@1018
|
403 |
/// degree (i.e. the number of incident edges) of a node \c n
|
deba@1018
|
404 |
/// in a graph \c g of type \c %BpGraph as follows.
|
deba@1018
|
405 |
///
|
deba@1018
|
406 |
///\code
|
deba@1018
|
407 |
/// int count=0;
|
deba@1018
|
408 |
/// for(BpGraph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
|
deba@1018
|
409 |
///\endcode
|
deba@1018
|
410 |
///
|
deba@1018
|
411 |
/// \warning Loop edges will be iterated twice.
|
deba@1018
|
412 |
class IncEdgeIt : public Edge {
|
deba@1018
|
413 |
public:
|
deba@1018
|
414 |
/// Default constructor
|
deba@1018
|
415 |
|
deba@1018
|
416 |
/// Default constructor.
|
deba@1018
|
417 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
418 |
IncEdgeIt() { }
|
deba@1018
|
419 |
/// Copy constructor.
|
deba@1018
|
420 |
|
deba@1018
|
421 |
/// Copy constructor.
|
deba@1018
|
422 |
///
|
deba@1018
|
423 |
IncEdgeIt(const IncEdgeIt& e) : Edge(e) { }
|
deba@1018
|
424 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
425 |
|
deba@1018
|
426 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
427 |
/// \sa Invalid for more details.
|
deba@1018
|
428 |
IncEdgeIt(Invalid) { }
|
deba@1018
|
429 |
/// Sets the iterator to the first incident edge.
|
deba@1018
|
430 |
|
deba@1018
|
431 |
/// Sets the iterator to the first incident edge of the given node.
|
deba@1018
|
432 |
///
|
deba@1018
|
433 |
IncEdgeIt(const BpGraph&, const Node&) { }
|
deba@1018
|
434 |
/// Sets the iterator to the given edge.
|
deba@1018
|
435 |
|
deba@1018
|
436 |
/// Sets the iterator to the given edge of the given graph.
|
deba@1018
|
437 |
///
|
deba@1018
|
438 |
IncEdgeIt(const BpGraph&, const Edge&) { }
|
deba@1018
|
439 |
/// Next incident edge
|
deba@1018
|
440 |
|
deba@1018
|
441 |
/// Assign the iterator to the next incident edge
|
deba@1018
|
442 |
/// of the corresponding node.
|
deba@1018
|
443 |
IncEdgeIt& operator++() { return *this; }
|
deba@1018
|
444 |
};
|
deba@1018
|
445 |
|
deba@1018
|
446 |
/// The arc type of the graph
|
deba@1018
|
447 |
|
deba@1018
|
448 |
/// This class identifies a directed arc of the graph. It also serves
|
deba@1018
|
449 |
/// as a base class of the arc iterators,
|
deba@1018
|
450 |
/// thus they will convert to this type.
|
deba@1018
|
451 |
class Arc {
|
deba@1018
|
452 |
public:
|
deba@1018
|
453 |
/// Default constructor
|
deba@1018
|
454 |
|
deba@1018
|
455 |
/// Default constructor.
|
deba@1018
|
456 |
/// \warning It sets the object to an undefined value.
|
deba@1018
|
457 |
Arc() { }
|
deba@1018
|
458 |
/// Copy constructor.
|
deba@1018
|
459 |
|
deba@1018
|
460 |
/// Copy constructor.
|
deba@1018
|
461 |
///
|
deba@1018
|
462 |
Arc(const Arc&) { }
|
deba@1018
|
463 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
464 |
|
deba@1018
|
465 |
/// Initializes the object to be invalid.
|
deba@1018
|
466 |
/// \sa Invalid for more details.
|
deba@1018
|
467 |
Arc(Invalid) { }
|
deba@1018
|
468 |
/// Equality operator
|
deba@1018
|
469 |
|
deba@1018
|
470 |
/// Equality operator.
|
deba@1018
|
471 |
///
|
deba@1018
|
472 |
/// Two iterators are equal if and only if they point to the
|
deba@1018
|
473 |
/// same object or both are \c INVALID.
|
deba@1018
|
474 |
bool operator==(Arc) const { return true; }
|
deba@1018
|
475 |
/// Inequality operator
|
deba@1018
|
476 |
|
deba@1018
|
477 |
/// Inequality operator.
|
deba@1018
|
478 |
bool operator!=(Arc) const { return true; }
|
deba@1018
|
479 |
|
deba@1018
|
480 |
/// Artificial ordering operator.
|
deba@1018
|
481 |
|
deba@1018
|
482 |
/// Artificial ordering operator.
|
deba@1018
|
483 |
///
|
deba@1018
|
484 |
/// \note This operator only has to define some strict ordering of
|
deba@1018
|
485 |
/// the arcs; this order has nothing to do with the iteration
|
deba@1018
|
486 |
/// ordering of the arcs.
|
deba@1018
|
487 |
bool operator<(Arc) const { return false; }
|
deba@1018
|
488 |
|
deba@1018
|
489 |
/// Converison to \c Edge
|
deba@1018
|
490 |
|
deba@1018
|
491 |
/// Converison to \c Edge.
|
deba@1018
|
492 |
///
|
deba@1018
|
493 |
operator Edge() const { return Edge(); }
|
deba@1018
|
494 |
};
|
deba@1018
|
495 |
|
deba@1018
|
496 |
/// Iterator class for the arcs.
|
deba@1018
|
497 |
|
deba@1018
|
498 |
/// This iterator goes through each directed arc of the graph.
|
deba@1018
|
499 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
500 |
/// of arcs in a graph \c g of type \c %BpGraph as follows:
|
deba@1018
|
501 |
///\code
|
deba@1018
|
502 |
/// int count=0;
|
deba@1018
|
503 |
/// for(BpGraph::ArcIt a(g); a!=INVALID; ++a) ++count;
|
deba@1018
|
504 |
///\endcode
|
deba@1018
|
505 |
class ArcIt : public Arc {
|
deba@1018
|
506 |
public:
|
deba@1018
|
507 |
/// Default constructor
|
deba@1018
|
508 |
|
deba@1018
|
509 |
/// Default constructor.
|
deba@1018
|
510 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
511 |
ArcIt() { }
|
deba@1018
|
512 |
/// Copy constructor.
|
deba@1018
|
513 |
|
deba@1018
|
514 |
/// Copy constructor.
|
deba@1018
|
515 |
///
|
deba@1018
|
516 |
ArcIt(const ArcIt& e) : Arc(e) { }
|
deba@1018
|
517 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
518 |
|
deba@1018
|
519 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
520 |
/// \sa Invalid for more details.
|
deba@1018
|
521 |
ArcIt(Invalid) { }
|
deba@1018
|
522 |
/// Sets the iterator to the first arc.
|
deba@1018
|
523 |
|
deba@1018
|
524 |
/// Sets the iterator to the first arc of the given graph.
|
deba@1018
|
525 |
///
|
alpar@1087
|
526 |
explicit ArcIt(const BpGraph &g)
|
alpar@1087
|
527 |
{
|
alpar@1087
|
528 |
::lemon::ignore_unused_variable_warning(g);
|
alpar@1087
|
529 |
}
|
deba@1018
|
530 |
/// Sets the iterator to the given arc.
|
deba@1018
|
531 |
|
deba@1018
|
532 |
/// Sets the iterator to the given arc of the given graph.
|
deba@1018
|
533 |
///
|
deba@1018
|
534 |
ArcIt(const BpGraph&, const Arc&) { }
|
deba@1018
|
535 |
/// Next arc
|
deba@1018
|
536 |
|
deba@1018
|
537 |
/// Assign the iterator to the next arc.
|
deba@1018
|
538 |
///
|
deba@1018
|
539 |
ArcIt& operator++() { return *this; }
|
deba@1018
|
540 |
};
|
deba@1018
|
541 |
|
deba@1018
|
542 |
/// Iterator class for the outgoing arcs of a node.
|
deba@1018
|
543 |
|
deba@1018
|
544 |
/// This iterator goes trough the \e outgoing directed arcs of a
|
deba@1018
|
545 |
/// certain node of a graph.
|
deba@1018
|
546 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
547 |
/// of outgoing arcs of a node \c n
|
deba@1018
|
548 |
/// in a graph \c g of type \c %BpGraph as follows.
|
deba@1018
|
549 |
///\code
|
deba@1018
|
550 |
/// int count=0;
|
deba@1018
|
551 |
/// for (Digraph::OutArcIt a(g, n); a!=INVALID; ++a) ++count;
|
deba@1018
|
552 |
///\endcode
|
deba@1018
|
553 |
class OutArcIt : public Arc {
|
deba@1018
|
554 |
public:
|
deba@1018
|
555 |
/// Default constructor
|
deba@1018
|
556 |
|
deba@1018
|
557 |
/// Default constructor.
|
deba@1018
|
558 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
559 |
OutArcIt() { }
|
deba@1018
|
560 |
/// Copy constructor.
|
deba@1018
|
561 |
|
deba@1018
|
562 |
/// Copy constructor.
|
deba@1018
|
563 |
///
|
deba@1018
|
564 |
OutArcIt(const OutArcIt& e) : Arc(e) { }
|
deba@1018
|
565 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
566 |
|
deba@1018
|
567 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
568 |
/// \sa Invalid for more details.
|
deba@1018
|
569 |
OutArcIt(Invalid) { }
|
deba@1018
|
570 |
/// Sets the iterator to the first outgoing arc.
|
deba@1018
|
571 |
|
deba@1018
|
572 |
/// Sets the iterator to the first outgoing arc of the given node.
|
deba@1018
|
573 |
///
|
deba@1018
|
574 |
OutArcIt(const BpGraph& n, const Node& g) {
|
alpar@1087
|
575 |
::lemon::ignore_unused_variable_warning(n);
|
alpar@1087
|
576 |
::lemon::ignore_unused_variable_warning(g);
|
deba@1018
|
577 |
}
|
deba@1018
|
578 |
/// Sets the iterator to the given arc.
|
deba@1018
|
579 |
|
deba@1018
|
580 |
/// Sets the iterator to the given arc of the given graph.
|
deba@1018
|
581 |
///
|
deba@1018
|
582 |
OutArcIt(const BpGraph&, const Arc&) { }
|
deba@1018
|
583 |
/// Next outgoing arc
|
deba@1018
|
584 |
|
deba@1018
|
585 |
/// Assign the iterator to the next
|
deba@1018
|
586 |
/// outgoing arc of the corresponding node.
|
deba@1018
|
587 |
OutArcIt& operator++() { return *this; }
|
deba@1018
|
588 |
};
|
deba@1018
|
589 |
|
deba@1018
|
590 |
/// Iterator class for the incoming arcs of a node.
|
deba@1018
|
591 |
|
deba@1018
|
592 |
/// This iterator goes trough the \e incoming directed arcs of a
|
deba@1018
|
593 |
/// certain node of a graph.
|
deba@1018
|
594 |
/// Its usage is quite simple, for example, you can count the number
|
deba@1018
|
595 |
/// of incoming arcs of a node \c n
|
deba@1018
|
596 |
/// in a graph \c g of type \c %BpGraph as follows.
|
deba@1018
|
597 |
///\code
|
deba@1018
|
598 |
/// int count=0;
|
deba@1018
|
599 |
/// for (Digraph::InArcIt a(g, n); a!=INVALID; ++a) ++count;
|
deba@1018
|
600 |
///\endcode
|
deba@1018
|
601 |
class InArcIt : public Arc {
|
deba@1018
|
602 |
public:
|
deba@1018
|
603 |
/// Default constructor
|
deba@1018
|
604 |
|
deba@1018
|
605 |
/// Default constructor.
|
deba@1018
|
606 |
/// \warning It sets the iterator to an undefined value.
|
deba@1018
|
607 |
InArcIt() { }
|
deba@1018
|
608 |
/// Copy constructor.
|
deba@1018
|
609 |
|
deba@1018
|
610 |
/// Copy constructor.
|
deba@1018
|
611 |
///
|
deba@1018
|
612 |
InArcIt(const InArcIt& e) : Arc(e) { }
|
deba@1018
|
613 |
/// %Invalid constructor \& conversion.
|
deba@1018
|
614 |
|
deba@1018
|
615 |
/// Initializes the iterator to be invalid.
|
deba@1018
|
616 |
/// \sa Invalid for more details.
|
deba@1018
|
617 |
InArcIt(Invalid) { }
|
deba@1018
|
618 |
/// Sets the iterator to the first incoming arc.
|
deba@1018
|
619 |
|
deba@1018
|
620 |
/// Sets the iterator to the first incoming arc of the given node.
|
deba@1018
|
621 |
///
|
deba@1018
|
622 |
InArcIt(const BpGraph& g, const Node& n) {
|
alpar@1087
|
623 |
::lemon::ignore_unused_variable_warning(n);
|
alpar@1087
|
624 |
::lemon::ignore_unused_variable_warning(g);
|
deba@1018
|
625 |
}
|
deba@1018
|
626 |
/// Sets the iterator to the given arc.
|
deba@1018
|
627 |
|
deba@1018
|
628 |
/// Sets the iterator to the given arc of the given graph.
|
deba@1018
|
629 |
///
|
deba@1018
|
630 |
InArcIt(const BpGraph&, const Arc&) { }
|
deba@1018
|
631 |
/// Next incoming arc
|
deba@1018
|
632 |
|
deba@1018
|
633 |
/// Assign the iterator to the next
|
deba@1018
|
634 |
/// incoming arc of the corresponding node.
|
deba@1018
|
635 |
InArcIt& operator++() { return *this; }
|
deba@1018
|
636 |
};
|
deba@1018
|
637 |
|
deba@1018
|
638 |
/// \brief Standard graph map type for the nodes.
|
deba@1018
|
639 |
///
|
deba@1018
|
640 |
/// Standard graph map type for the nodes.
|
deba@1018
|
641 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
642 |
template<class T>
|
deba@1018
|
643 |
class NodeMap : public ReferenceMap<Node, T, T&, const T&>
|
deba@1018
|
644 |
{
|
deba@1018
|
645 |
public:
|
deba@1018
|
646 |
|
deba@1018
|
647 |
/// Constructor
|
deba@1018
|
648 |
explicit NodeMap(const BpGraph&) { }
|
deba@1018
|
649 |
/// Constructor with given initial value
|
deba@1018
|
650 |
NodeMap(const BpGraph&, T) { }
|
deba@1018
|
651 |
|
deba@1018
|
652 |
private:
|
deba@1018
|
653 |
///Copy constructor
|
deba@1018
|
654 |
NodeMap(const NodeMap& nm) :
|
deba@1018
|
655 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
deba@1018
|
656 |
///Assignment operator
|
deba@1018
|
657 |
template <typename CMap>
|
deba@1018
|
658 |
NodeMap& operator=(const CMap&) {
|
deba@1018
|
659 |
checkConcept<ReadMap<Node, T>, CMap>();
|
deba@1018
|
660 |
return *this;
|
deba@1018
|
661 |
}
|
deba@1018
|
662 |
};
|
deba@1018
|
663 |
|
deba@1018
|
664 |
/// \brief Standard graph map type for the red nodes.
|
deba@1018
|
665 |
///
|
deba@1018
|
666 |
/// Standard graph map type for the red nodes.
|
deba@1018
|
667 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
668 |
template<class T>
|
deba@1026
|
669 |
class RedNodeMap : public ReferenceMap<Node, T, T&, const T&>
|
deba@1018
|
670 |
{
|
deba@1018
|
671 |
public:
|
deba@1018
|
672 |
|
deba@1018
|
673 |
/// Constructor
|
deba@1026
|
674 |
explicit RedNodeMap(const BpGraph&) { }
|
deba@1018
|
675 |
/// Constructor with given initial value
|
deba@1026
|
676 |
RedNodeMap(const BpGraph&, T) { }
|
deba@1018
|
677 |
|
deba@1018
|
678 |
private:
|
deba@1018
|
679 |
///Copy constructor
|
deba@1026
|
680 |
RedNodeMap(const RedNodeMap& nm) :
|
deba@1018
|
681 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
deba@1018
|
682 |
///Assignment operator
|
deba@1018
|
683 |
template <typename CMap>
|
deba@1026
|
684 |
RedNodeMap& operator=(const CMap&) {
|
deba@1018
|
685 |
checkConcept<ReadMap<Node, T>, CMap>();
|
deba@1018
|
686 |
return *this;
|
deba@1018
|
687 |
}
|
deba@1018
|
688 |
};
|
deba@1018
|
689 |
|
deba@1018
|
690 |
/// \brief Standard graph map type for the blue nodes.
|
deba@1018
|
691 |
///
|
deba@1018
|
692 |
/// Standard graph map type for the blue nodes.
|
deba@1018
|
693 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
694 |
template<class T>
|
deba@1026
|
695 |
class BlueNodeMap : public ReferenceMap<Node, T, T&, const T&>
|
deba@1018
|
696 |
{
|
deba@1018
|
697 |
public:
|
deba@1018
|
698 |
|
deba@1018
|
699 |
/// Constructor
|
deba@1026
|
700 |
explicit BlueNodeMap(const BpGraph&) { }
|
deba@1018
|
701 |
/// Constructor with given initial value
|
deba@1026
|
702 |
BlueNodeMap(const BpGraph&, T) { }
|
deba@1018
|
703 |
|
deba@1018
|
704 |
private:
|
deba@1018
|
705 |
///Copy constructor
|
deba@1026
|
706 |
BlueNodeMap(const BlueNodeMap& nm) :
|
deba@1018
|
707 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
deba@1018
|
708 |
///Assignment operator
|
deba@1018
|
709 |
template <typename CMap>
|
deba@1026
|
710 |
BlueNodeMap& operator=(const CMap&) {
|
deba@1018
|
711 |
checkConcept<ReadMap<Node, T>, CMap>();
|
deba@1018
|
712 |
return *this;
|
deba@1018
|
713 |
}
|
deba@1018
|
714 |
};
|
deba@1018
|
715 |
|
deba@1018
|
716 |
/// \brief Standard graph map type for the arcs.
|
deba@1018
|
717 |
///
|
deba@1018
|
718 |
/// Standard graph map type for the arcs.
|
deba@1018
|
719 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
720 |
template<class T>
|
deba@1018
|
721 |
class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
|
deba@1018
|
722 |
{
|
deba@1018
|
723 |
public:
|
deba@1018
|
724 |
|
deba@1018
|
725 |
/// Constructor
|
deba@1018
|
726 |
explicit ArcMap(const BpGraph&) { }
|
deba@1018
|
727 |
/// Constructor with given initial value
|
deba@1018
|
728 |
ArcMap(const BpGraph&, T) { }
|
deba@1018
|
729 |
|
deba@1018
|
730 |
private:
|
deba@1018
|
731 |
///Copy constructor
|
deba@1018
|
732 |
ArcMap(const ArcMap& em) :
|
deba@1018
|
733 |
ReferenceMap<Arc, T, T&, const T&>(em) { }
|
deba@1018
|
734 |
///Assignment operator
|
deba@1018
|
735 |
template <typename CMap>
|
deba@1018
|
736 |
ArcMap& operator=(const CMap&) {
|
deba@1018
|
737 |
checkConcept<ReadMap<Arc, T>, CMap>();
|
deba@1018
|
738 |
return *this;
|
deba@1018
|
739 |
}
|
deba@1018
|
740 |
};
|
deba@1018
|
741 |
|
deba@1018
|
742 |
/// \brief Standard graph map type for the edges.
|
deba@1018
|
743 |
///
|
deba@1018
|
744 |
/// Standard graph map type for the edges.
|
deba@1018
|
745 |
/// It conforms to the ReferenceMap concept.
|
deba@1018
|
746 |
template<class T>
|
deba@1018
|
747 |
class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
|
deba@1018
|
748 |
{
|
deba@1018
|
749 |
public:
|
deba@1018
|
750 |
|
deba@1018
|
751 |
/// Constructor
|
deba@1018
|
752 |
explicit EdgeMap(const BpGraph&) { }
|
deba@1018
|
753 |
/// Constructor with given initial value
|
deba@1018
|
754 |
EdgeMap(const BpGraph&, T) { }
|
deba@1018
|
755 |
|
deba@1018
|
756 |
private:
|
deba@1018
|
757 |
///Copy constructor
|
deba@1018
|
758 |
EdgeMap(const EdgeMap& em) :
|
deba@1018
|
759 |
ReferenceMap<Edge, T, T&, const T&>(em) {}
|
deba@1018
|
760 |
///Assignment operator
|
deba@1018
|
761 |
template <typename CMap>
|
deba@1018
|
762 |
EdgeMap& operator=(const CMap&) {
|
deba@1018
|
763 |
checkConcept<ReadMap<Edge, T>, CMap>();
|
deba@1018
|
764 |
return *this;
|
deba@1018
|
765 |
}
|
deba@1018
|
766 |
};
|
deba@1018
|
767 |
|
deba@1018
|
768 |
/// \brief Gives back %true for red nodes.
|
deba@1018
|
769 |
///
|
deba@1018
|
770 |
/// Gives back %true for red nodes.
|
deba@1018
|
771 |
bool red(const Node&) const { return true; }
|
deba@1018
|
772 |
|
deba@1018
|
773 |
/// \brief Gives back %true for blue nodes.
|
deba@1018
|
774 |
///
|
deba@1018
|
775 |
/// Gives back %true for blue nodes.
|
deba@1018
|
776 |
bool blue(const Node&) const { return true; }
|
deba@1018
|
777 |
|
deba@1025
|
778 |
/// \brief Converts the node to red node object.
|
deba@1025
|
779 |
///
|
deba@1028
|
780 |
/// This function converts unsafely the node to red node
|
deba@1025
|
781 |
/// object. It should be called only if the node is from the red
|
deba@1025
|
782 |
/// partition or INVALID.
|
deba@1025
|
783 |
RedNode asRedNodeUnsafe(const Node&) const { return RedNode(); }
|
deba@1025
|
784 |
|
deba@1025
|
785 |
/// \brief Converts the node to blue node object.
|
deba@1025
|
786 |
///
|
deba@1028
|
787 |
/// This function converts unsafely the node to blue node
|
deba@1025
|
788 |
/// object. It should be called only if the node is from the red
|
deba@1025
|
789 |
/// partition or INVALID.
|
deba@1025
|
790 |
BlueNode asBlueNodeUnsafe(const Node&) const { return BlueNode(); }
|
deba@1025
|
791 |
|
deba@1025
|
792 |
/// \brief Converts the node to red node object.
|
deba@1025
|
793 |
///
|
deba@1028
|
794 |
/// This function converts safely the node to red node
|
deba@1025
|
795 |
/// object. If the node is not from the red partition, then it
|
deba@1025
|
796 |
/// returns INVALID.
|
deba@1025
|
797 |
RedNode asRedNode(const Node&) const { return RedNode(); }
|
deba@1025
|
798 |
|
deba@1025
|
799 |
/// \brief Converts the node to blue node object.
|
deba@1025
|
800 |
///
|
deba@1028
|
801 |
/// This function converts unsafely the node to blue node
|
deba@1025
|
802 |
/// object. If the node is not from the blue partition, then it
|
deba@1025
|
803 |
/// returns INVALID.
|
deba@1025
|
804 |
BlueNode asBlueNode(const Node&) const { return BlueNode(); }
|
deba@1025
|
805 |
|
deba@1018
|
806 |
/// \brief Gives back the red end node of the edge.
|
alpar@1092
|
807 |
///
|
deba@1018
|
808 |
/// Gives back the red end node of the edge.
|
deba@1025
|
809 |
RedNode redNode(const Edge&) const { return RedNode(); }
|
deba@1018
|
810 |
|
deba@1018
|
811 |
/// \brief Gives back the blue end node of the edge.
|
alpar@1092
|
812 |
///
|
deba@1018
|
813 |
/// Gives back the blue end node of the edge.
|
deba@1025
|
814 |
BlueNode blueNode(const Edge&) const { return BlueNode(); }
|
deba@1018
|
815 |
|
deba@1018
|
816 |
/// \brief The first node of the edge.
|
deba@1018
|
817 |
///
|
deba@1018
|
818 |
/// It is a synonim for the \c redNode().
|
deba@1018
|
819 |
Node u(Edge) const { return INVALID; }
|
deba@1018
|
820 |
|
deba@1018
|
821 |
/// \brief The second node of the edge.
|
deba@1018
|
822 |
///
|
deba@1018
|
823 |
/// It is a synonim for the \c blueNode().
|
deba@1018
|
824 |
Node v(Edge) const { return INVALID; }
|
deba@1018
|
825 |
|
deba@1018
|
826 |
/// \brief The source node of the arc.
|
deba@1018
|
827 |
///
|
deba@1018
|
828 |
/// Returns the source node of the given arc.
|
deba@1018
|
829 |
Node source(Arc) const { return INVALID; }
|
deba@1018
|
830 |
|
deba@1018
|
831 |
/// \brief The target node of the arc.
|
deba@1018
|
832 |
///
|
deba@1018
|
833 |
/// Returns the target node of the given arc.
|
deba@1018
|
834 |
Node target(Arc) const { return INVALID; }
|
deba@1018
|
835 |
|
deba@1018
|
836 |
/// \brief The ID of the node.
|
deba@1018
|
837 |
///
|
deba@1018
|
838 |
/// Returns the ID of the given node.
|
deba@1018
|
839 |
int id(Node) const { return -1; }
|
deba@1018
|
840 |
|
deba@1018
|
841 |
/// \brief The red ID of the node.
|
deba@1018
|
842 |
///
|
deba@1018
|
843 |
/// Returns the red ID of the given node.
|
deba@1018
|
844 |
int id(RedNode) const { return -1; }
|
deba@1018
|
845 |
|
deba@1018
|
846 |
/// \brief The blue ID of the node.
|
deba@1018
|
847 |
///
|
deba@1018
|
848 |
/// Returns the blue ID of the given node.
|
deba@1018
|
849 |
int id(BlueNode) const { return -1; }
|
deba@1018
|
850 |
|
deba@1018
|
851 |
/// \brief The ID of the edge.
|
deba@1018
|
852 |
///
|
deba@1018
|
853 |
/// Returns the ID of the given edge.
|
deba@1018
|
854 |
int id(Edge) const { return -1; }
|
deba@1018
|
855 |
|
deba@1018
|
856 |
/// \brief The ID of the arc.
|
deba@1018
|
857 |
///
|
deba@1018
|
858 |
/// Returns the ID of the given arc.
|
deba@1018
|
859 |
int id(Arc) const { return -1; }
|
deba@1018
|
860 |
|
deba@1018
|
861 |
/// \brief The node with the given ID.
|
deba@1018
|
862 |
///
|
deba@1018
|
863 |
/// Returns the node with the given ID.
|
deba@1018
|
864 |
/// \pre The argument should be a valid node ID in the graph.
|
deba@1018
|
865 |
Node nodeFromId(int) const { return INVALID; }
|
deba@1018
|
866 |
|
deba@1018
|
867 |
/// \brief The edge with the given ID.
|
deba@1018
|
868 |
///
|
deba@1018
|
869 |
/// Returns the edge with the given ID.
|
deba@1018
|
870 |
/// \pre The argument should be a valid edge ID in the graph.
|
deba@1018
|
871 |
Edge edgeFromId(int) const { return INVALID; }
|
deba@1018
|
872 |
|
deba@1018
|
873 |
/// \brief The arc with the given ID.
|
deba@1018
|
874 |
///
|
deba@1018
|
875 |
/// Returns the arc with the given ID.
|
deba@1018
|
876 |
/// \pre The argument should be a valid arc ID in the graph.
|
deba@1018
|
877 |
Arc arcFromId(int) const { return INVALID; }
|
deba@1018
|
878 |
|
deba@1018
|
879 |
/// \brief An upper bound on the node IDs.
|
deba@1018
|
880 |
///
|
deba@1018
|
881 |
/// Returns an upper bound on the node IDs.
|
deba@1018
|
882 |
int maxNodeId() const { return -1; }
|
deba@1018
|
883 |
|
deba@1018
|
884 |
/// \brief An upper bound on the red IDs.
|
deba@1018
|
885 |
///
|
deba@1018
|
886 |
/// Returns an upper bound on the red IDs.
|
deba@1018
|
887 |
int maxRedId() const { return -1; }
|
deba@1018
|
888 |
|
deba@1018
|
889 |
/// \brief An upper bound on the blue IDs.
|
deba@1018
|
890 |
///
|
deba@1018
|
891 |
/// Returns an upper bound on the blue IDs.
|
deba@1018
|
892 |
int maxBlueId() const { return -1; }
|
deba@1018
|
893 |
|
deba@1018
|
894 |
/// \brief An upper bound on the edge IDs.
|
deba@1018
|
895 |
///
|
deba@1018
|
896 |
/// Returns an upper bound on the edge IDs.
|
deba@1018
|
897 |
int maxEdgeId() const { return -1; }
|
deba@1018
|
898 |
|
deba@1018
|
899 |
/// \brief An upper bound on the arc IDs.
|
deba@1018
|
900 |
///
|
deba@1018
|
901 |
/// Returns an upper bound on the arc IDs.
|
deba@1018
|
902 |
int maxArcId() const { return -1; }
|
deba@1018
|
903 |
|
deba@1018
|
904 |
/// \brief The direction of the arc.
|
deba@1018
|
905 |
///
|
deba@1018
|
906 |
/// Returns \c true if the given arc goes from a red node to a blue node.
|
deba@1018
|
907 |
bool direction(Arc) const { return true; }
|
deba@1018
|
908 |
|
deba@1018
|
909 |
/// \brief Direct the edge.
|
deba@1018
|
910 |
///
|
deba@1018
|
911 |
/// Direct the given edge. The returned arc
|
deba@1018
|
912 |
/// represents the given edge and its direction comes
|
deba@1018
|
913 |
/// from the bool parameter. If it is \c true, then the source of the node
|
deba@1018
|
914 |
/// will be a red node.
|
deba@1018
|
915 |
Arc direct(Edge, bool) const {
|
deba@1018
|
916 |
return INVALID;
|
deba@1018
|
917 |
}
|
deba@1018
|
918 |
|
deba@1018
|
919 |
/// \brief Direct the edge.
|
deba@1018
|
920 |
///
|
deba@1018
|
921 |
/// Direct the given edge. The returned arc represents the given
|
deba@1018
|
922 |
/// edge and its source node is the given node.
|
deba@1018
|
923 |
Arc direct(Edge, Node) const {
|
deba@1018
|
924 |
return INVALID;
|
deba@1018
|
925 |
}
|
deba@1018
|
926 |
|
deba@1018
|
927 |
/// \brief The oppositely directed arc.
|
deba@1018
|
928 |
///
|
deba@1018
|
929 |
/// Returns the oppositely directed arc representing the same edge.
|
deba@1018
|
930 |
Arc oppositeArc(Arc) const { return INVALID; }
|
deba@1018
|
931 |
|
deba@1018
|
932 |
/// \brief The opposite node on the edge.
|
deba@1018
|
933 |
///
|
deba@1018
|
934 |
/// Returns the opposite node on the given edge.
|
deba@1018
|
935 |
Node oppositeNode(Node, Edge) const { return INVALID; }
|
deba@1018
|
936 |
|
deba@1018
|
937 |
void first(Node&) const {}
|
deba@1018
|
938 |
void next(Node&) const {}
|
deba@1018
|
939 |
|
deba@1025
|
940 |
void firstRed(RedNode&) const {}
|
deba@1025
|
941 |
void nextRed(RedNode&) const {}
|
deba@1018
|
942 |
|
deba@1025
|
943 |
void firstBlue(BlueNode&) const {}
|
deba@1025
|
944 |
void nextBlue(BlueNode&) const {}
|
deba@1018
|
945 |
|
deba@1018
|
946 |
void first(Edge&) const {}
|
deba@1018
|
947 |
void next(Edge&) const {}
|
deba@1018
|
948 |
|
deba@1018
|
949 |
void first(Arc&) const {}
|
deba@1018
|
950 |
void next(Arc&) const {}
|
deba@1018
|
951 |
|
deba@1018
|
952 |
void firstOut(Arc&, Node) const {}
|
deba@1018
|
953 |
void nextOut(Arc&) const {}
|
deba@1018
|
954 |
|
deba@1018
|
955 |
void firstIn(Arc&, Node) const {}
|
deba@1018
|
956 |
void nextIn(Arc&) const {}
|
deba@1018
|
957 |
|
deba@1018
|
958 |
void firstInc(Edge &, bool &, const Node &) const {}
|
deba@1018
|
959 |
void nextInc(Edge &, bool &) const {}
|
deba@1018
|
960 |
|
deba@1018
|
961 |
// The second parameter is dummy.
|
deba@1018
|
962 |
Node fromId(int, Node) const { return INVALID; }
|
deba@1018
|
963 |
// The second parameter is dummy.
|
deba@1018
|
964 |
Edge fromId(int, Edge) const { return INVALID; }
|
deba@1018
|
965 |
// The second parameter is dummy.
|
deba@1018
|
966 |
Arc fromId(int, Arc) const { return INVALID; }
|
deba@1018
|
967 |
|
deba@1018
|
968 |
// Dummy parameter.
|
deba@1018
|
969 |
int maxId(Node) const { return -1; }
|
deba@1018
|
970 |
// Dummy parameter.
|
deba@1018
|
971 |
int maxId(RedNode) const { return -1; }
|
deba@1018
|
972 |
// Dummy parameter.
|
deba@1018
|
973 |
int maxId(BlueNode) const { return -1; }
|
deba@1018
|
974 |
// Dummy parameter.
|
deba@1018
|
975 |
int maxId(Edge) const { return -1; }
|
deba@1018
|
976 |
// Dummy parameter.
|
deba@1018
|
977 |
int maxId(Arc) const { return -1; }
|
deba@1018
|
978 |
|
deba@1018
|
979 |
/// \brief The base node of the iterator.
|
deba@1018
|
980 |
///
|
deba@1018
|
981 |
/// Returns the base node of the given incident edge iterator.
|
deba@1018
|
982 |
Node baseNode(IncEdgeIt) const { return INVALID; }
|
deba@1018
|
983 |
|
deba@1018
|
984 |
/// \brief The running node of the iterator.
|
deba@1018
|
985 |
///
|
deba@1018
|
986 |
/// Returns the running node of the given incident edge iterator.
|
deba@1018
|
987 |
Node runningNode(IncEdgeIt) const { return INVALID; }
|
deba@1018
|
988 |
|
deba@1018
|
989 |
/// \brief The base node of the iterator.
|
deba@1018
|
990 |
///
|
deba@1018
|
991 |
/// Returns the base node of the given outgoing arc iterator
|
deba@1018
|
992 |
/// (i.e. the source node of the corresponding arc).
|
deba@1018
|
993 |
Node baseNode(OutArcIt) const { return INVALID; }
|
deba@1018
|
994 |
|
deba@1018
|
995 |
/// \brief The running node of the iterator.
|
deba@1018
|
996 |
///
|
deba@1018
|
997 |
/// Returns the running node of the given outgoing arc iterator
|
deba@1018
|
998 |
/// (i.e. the target node of the corresponding arc).
|
deba@1018
|
999 |
Node runningNode(OutArcIt) const { return INVALID; }
|
deba@1018
|
1000 |
|
deba@1018
|
1001 |
/// \brief The base node of the iterator.
|
deba@1018
|
1002 |
///
|
kpeter@1049
|
1003 |
/// Returns the base node of the given incoming arc iterator
|
deba@1018
|
1004 |
/// (i.e. the target node of the corresponding arc).
|
deba@1018
|
1005 |
Node baseNode(InArcIt) const { return INVALID; }
|
deba@1018
|
1006 |
|
deba@1018
|
1007 |
/// \brief The running node of the iterator.
|
deba@1018
|
1008 |
///
|
kpeter@1049
|
1009 |
/// Returns the running node of the given incoming arc iterator
|
deba@1018
|
1010 |
/// (i.e. the source node of the corresponding arc).
|
deba@1018
|
1011 |
Node runningNode(InArcIt) const { return INVALID; }
|
deba@1018
|
1012 |
|
deba@1018
|
1013 |
template <typename _BpGraph>
|
deba@1018
|
1014 |
struct Constraints {
|
deba@1018
|
1015 |
void constraints() {
|
deba@1018
|
1016 |
checkConcept<BaseBpGraphComponent, _BpGraph>();
|
deba@1018
|
1017 |
checkConcept<IterableBpGraphComponent<>, _BpGraph>();
|
deba@1018
|
1018 |
checkConcept<IDableBpGraphComponent<>, _BpGraph>();
|
deba@1018
|
1019 |
checkConcept<MappableBpGraphComponent<>, _BpGraph>();
|
deba@1018
|
1020 |
}
|
deba@1018
|
1021 |
};
|
deba@1018
|
1022 |
|
deba@1018
|
1023 |
};
|
deba@1018
|
1024 |
|
deba@1018
|
1025 |
}
|
deba@1018
|
1026 |
|
deba@1018
|
1027 |
}
|
deba@1018
|
1028 |
|
deba@1018
|
1029 |
#endif
|