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