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