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