gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Change Graph::Edge -> Graph::Arc inheritance to conversion (#283)
0 1 0
default
1 file changed with 5 insertions and 3 deletions:
↑ Collapse diff ↑
Show white space 768 line context
1 1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2009
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
///\ingroup graph_concepts
20 20
///\file
21 21
///\brief The concept of Undirected Graphs.
22 22

	
23 23
#ifndef LEMON_CONCEPTS_GRAPH_H
24 24
#define LEMON_CONCEPTS_GRAPH_H
25 25

	
26 26
#include <lemon/concepts/graph_components.h>
27 27
#include <lemon/core.h>
28 28

	
29 29
namespace lemon {
30 30
  namespace concepts {
31 31

	
32 32
    /// \ingroup graph_concepts
33 33
    ///
34 34
    /// \brief Class describing the concept of Undirected Graphs.
35 35
    ///
36 36
    /// This class describes the common interface of all Undirected
37 37
    /// Graphs.
38 38
    ///
39 39
    /// As all concept describing classes it provides only interface
40 40
    /// without any sensible implementation. So any algorithm for
41 41
    /// undirected graph should compile with this class, but it will not
42 42
    /// run properly, of course.
43 43
    ///
44 44
    /// The LEMON undirected graphs also fulfill the concept of
45 45
    /// directed graphs (\ref lemon::concepts::Digraph "Digraph
46 46
    /// Concept"). Each edges can be seen as two opposite
47 47
    /// directed arc and consequently the undirected graph can be
48 48
    /// seen as the direceted graph of these directed arcs. The
49 49
    /// Graph has the Edge inner class for the edges and
50 50
    /// the Arc type for the directed arcs. The Arc type is
51 51
    /// convertible to Edge or inherited from it so from a directed
52 52
    /// arc we can get the represented edge.
53 53
    ///
54 54
    /// In the sense of the LEMON each edge has a default
55 55
    /// direction (it should be in every computer implementation,
56 56
    /// because the order of edge's nodes defines an
57 57
    /// orientation). With the default orientation we can define that
58 58
    /// the directed arc is forward or backward directed. With the \c
59 59
    /// direction() and \c direct() function we can get the direction
60 60
    /// of the directed arc and we can direct an edge.
61 61
    ///
62 62
    /// The EdgeIt is an iterator for the edges. We can use
63 63
    /// the EdgeMap to map values for the edges. The InArcIt and
64 64
    /// OutArcIt iterates on the same edges but with opposite
65 65
    /// direction. The IncEdgeIt iterates also on the same edges
66 66
    /// as the OutArcIt and InArcIt but it is not convertible to Arc just
67 67
    /// to Edge.
68 68
    class Graph {
69 69
    public:
70 70
      /// \brief The undirected graph should be tagged by the
71 71
      /// UndirectedTag.
72 72
      ///
73 73
      /// The undirected graph should be tagged by the UndirectedTag. This
74 74
      /// tag helps the enable_if technics to make compile time
75 75
      /// specializations for undirected graphs.
76 76
      typedef True UndirectedTag;
77 77

	
78 78
      /// \brief The base type of node iterators,
79 79
      /// or in other words, the trivial node iterator.
80 80
      ///
81 81
      /// This is the base type of each node iterator,
82 82
      /// thus each kind of node iterator converts to this.
83 83
      /// More precisely each kind of node iterator should be inherited
84 84
      /// from the trivial node iterator.
85 85
      class Node {
86 86
      public:
87 87
        /// Default constructor
88 88

	
89 89
        /// @warning The default constructor sets the iterator
90 90
        /// to an undefined value.
91 91
        Node() { }
92 92
        /// Copy constructor.
93 93

	
94 94
        /// Copy constructor.
95 95
        ///
96 96
        Node(const Node&) { }
97 97

	
98 98
        /// Invalid constructor \& conversion.
99 99

	
100 100
        /// This constructor initializes the iterator to be invalid.
101 101
        /// \sa Invalid for more details.
102 102
        Node(Invalid) { }
103 103
        /// Equality operator
104 104

	
105 105
        /// Two iterators are equal if and only if they point to the
106 106
        /// same object or both are invalid.
107 107
        bool operator==(Node) const { return true; }
108 108

	
109 109
        /// Inequality operator
110 110

	
111 111
        /// \sa operator==(Node n)
112 112
        ///
113 113
        bool operator!=(Node) const { return true; }
114 114

	
115 115
        /// Artificial ordering operator.
116 116

	
117 117
        /// To allow the use of graph descriptors as key type in std::map or
118 118
        /// similar associative container we require this.
119 119
        ///
120 120
        /// \note This operator only have to define some strict ordering of
121 121
        /// the items; this order has nothing to do with the iteration
122 122
        /// ordering of the items.
123 123
        bool operator<(Node) const { return false; }
124 124

	
125 125
      };
126 126

	
127 127
      /// This iterator goes through each node.
128 128

	
129 129
      /// This iterator goes through each node.
130 130
      /// Its usage is quite simple, for example you can count the number
131 131
      /// of nodes in graph \c g of type \c Graph like this:
132 132
      ///\code
133 133
      /// int count=0;
134 134
      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
135 135
      ///\endcode
136 136
      class NodeIt : public Node {
137 137
      public:
138 138
        /// Default constructor
139 139

	
140 140
        /// @warning The default constructor sets the iterator
141 141
        /// to an undefined value.
142 142
        NodeIt() { }
143 143
        /// Copy constructor.
144 144

	
145 145
        /// Copy constructor.
146 146
        ///
147 147
        NodeIt(const NodeIt& n) : Node(n) { }
148 148
        /// Invalid constructor \& conversion.
149 149

	
150 150
        /// Initialize the iterator to be invalid.
151 151
        /// \sa Invalid for more details.
152 152
        NodeIt(Invalid) { }
153 153
        /// Sets the iterator to the first node.
154 154

	
155 155
        /// Sets the iterator to the first node of \c g.
156 156
        ///
157 157
        NodeIt(const Graph&) { }
158 158
        /// Node -> NodeIt conversion.
159 159

	
160 160
        /// Sets the iterator to the node of \c the graph pointed by
161 161
        /// the trivial iterator.
162 162
        /// This feature necessitates that each time we
163 163
        /// iterate the arc-set, the iteration order is the same.
164 164
        NodeIt(const Graph&, const Node&) { }
165 165
        /// Next node.
166 166

	
167 167
        /// Assign the iterator to the next node.
168 168
        ///
169 169
        NodeIt& operator++() { return *this; }
170 170
      };
171 171

	
172 172

	
173 173
      /// The base type of the edge iterators.
174 174

	
175 175
      /// The base type of the edge iterators.
176 176
      ///
177 177
      class Edge {
178 178
      public:
179 179
        /// Default constructor
180 180

	
181 181
        /// @warning The default constructor sets the iterator
182 182
        /// to an undefined value.
183 183
        Edge() { }
184 184
        /// Copy constructor.
185 185

	
186 186
        /// Copy constructor.
187 187
        ///
188 188
        Edge(const Edge&) { }
189 189
        /// Initialize the iterator to be invalid.
190 190

	
191 191
        /// Initialize the iterator to be invalid.
192 192
        ///
193 193
        Edge(Invalid) { }
194 194
        /// Equality operator
195 195

	
196 196
        /// Two iterators are equal if and only if they point to the
197 197
        /// same object or both are invalid.
198 198
        bool operator==(Edge) const { return true; }
199 199
        /// Inequality operator
200 200

	
201 201
        /// \sa operator==(Edge n)
202 202
        ///
203 203
        bool operator!=(Edge) const { return true; }
204 204

	
205 205
        /// Artificial ordering operator.
206 206

	
207 207
        /// To allow the use of graph descriptors as key type in std::map or
208 208
        /// similar associative container we require this.
209 209
        ///
210 210
        /// \note This operator only have to define some strict ordering of
211 211
        /// the items; this order has nothing to do with the iteration
212 212
        /// ordering of the items.
213 213
        bool operator<(Edge) const { return false; }
214 214
      };
215 215

	
216 216
      /// This iterator goes through each edge.
217 217

	
218 218
      /// This iterator goes through each edge of a graph.
219 219
      /// Its usage is quite simple, for example you can count the number
220 220
      /// of edges in a graph \c g of type \c Graph as follows:
221 221
      ///\code
222 222
      /// int count=0;
223 223
      /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
224 224
      ///\endcode
225 225
      class EdgeIt : public Edge {
226 226
      public:
227 227
        /// Default constructor
228 228

	
229 229
        /// @warning The default constructor sets the iterator
230 230
        /// to an undefined value.
231 231
        EdgeIt() { }
232 232
        /// Copy constructor.
233 233

	
234 234
        /// Copy constructor.
235 235
        ///
236 236
        EdgeIt(const EdgeIt& e) : Edge(e) { }
237 237
        /// Initialize the iterator to be invalid.
238 238

	
239 239
        /// Initialize the iterator to be invalid.
240 240
        ///
241 241
        EdgeIt(Invalid) { }
242 242
        /// This constructor sets the iterator to the first edge.
243 243

	
244 244
        /// This constructor sets the iterator to the first edge.
245 245
        EdgeIt(const Graph&) { }
246 246
        /// Edge -> EdgeIt conversion
247 247

	
248 248
        /// Sets the iterator to the value of the trivial iterator.
249 249
        /// This feature necessitates that each time we
250 250
        /// iterate the edge-set, the iteration order is the
251 251
        /// same.
252 252
        EdgeIt(const Graph&, const Edge&) { }
253 253
        /// Next edge
254 254

	
255 255
        /// Assign the iterator to the next edge.
256 256
        EdgeIt& operator++() { return *this; }
257 257
      };
258 258

	
259 259
      /// \brief This iterator goes trough the incident undirected
260 260
      /// arcs of a node.
261 261
      ///
262 262
      /// This iterator goes trough the incident edges
263 263
      /// of a certain node of a graph. You should assume that the
264 264
      /// loop arcs will be iterated twice.
265 265
      ///
266 266
      /// Its usage is quite simple, for example you can compute the
267 267
      /// degree (i.e. count the number of incident arcs of a node \c n
268 268
      /// in graph \c g of type \c Graph as follows.
269 269
      ///
270 270
      ///\code
271 271
      /// int count=0;
272 272
      /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
273 273
      ///\endcode
274 274
      class IncEdgeIt : public Edge {
275 275
      public:
276 276
        /// Default constructor
277 277

	
278 278
        /// @warning The default constructor sets the iterator
279 279
        /// to an undefined value.
280 280
        IncEdgeIt() { }
281 281
        /// Copy constructor.
282 282

	
283 283
        /// Copy constructor.
284 284
        ///
285 285
        IncEdgeIt(const IncEdgeIt& e) : Edge(e) { }
286 286
        /// Initialize the iterator to be invalid.
287 287

	
288 288
        /// Initialize the iterator to be invalid.
289 289
        ///
290 290
        IncEdgeIt(Invalid) { }
291 291
        /// This constructor sets the iterator to first incident arc.
292 292

	
293 293
        /// This constructor set the iterator to the first incident arc of
294 294
        /// the node.
295 295
        IncEdgeIt(const Graph&, const Node&) { }
296 296
        /// Edge -> IncEdgeIt conversion
297 297

	
298 298
        /// Sets the iterator to the value of the trivial iterator \c e.
299 299
        /// This feature necessitates that each time we
300 300
        /// iterate the arc-set, the iteration order is the same.
301 301
        IncEdgeIt(const Graph&, const Edge&) { }
302 302
        /// Next incident arc
303 303

	
304 304
        /// Assign the iterator to the next incident arc
305 305
        /// of the corresponding node.
306 306
        IncEdgeIt& operator++() { return *this; }
307 307
      };
308 308

	
309 309
      /// The directed arc type.
310 310

	
311 311
      /// The directed arc type. It can be converted to the
312 312
      /// edge or it should be inherited from the undirected
313
      /// arc.
314
      class Arc : public Edge {
313
      /// edge.
314
      class Arc {
315 315
      public:
316 316
        /// Default constructor
317 317

	
318 318
        /// @warning The default constructor sets the iterator
319 319
        /// to an undefined value.
320 320
        Arc() { }
321 321
        /// Copy constructor.
322 322

	
323 323
        /// Copy constructor.
324 324
        ///
325
        Arc(const Arc& e) : Edge(e) { }
325
        Arc(const Arc&) { }
326 326
        /// Initialize the iterator to be invalid.
327 327

	
328 328
        /// Initialize the iterator to be invalid.
329 329
        ///
330 330
        Arc(Invalid) { }
331 331
        /// Equality operator
332 332

	
333 333
        /// Two iterators are equal if and only if they point to the
334 334
        /// same object or both are invalid.
335 335
        bool operator==(Arc) const { return true; }
336 336
        /// Inequality operator
337 337

	
338 338
        /// \sa operator==(Arc n)
339 339
        ///
340 340
        bool operator!=(Arc) const { return true; }
341 341

	
342 342
        /// Artificial ordering operator.
343 343

	
344 344
        /// To allow the use of graph descriptors as key type in std::map or
345 345
        /// similar associative container we require this.
346 346
        ///
347 347
        /// \note This operator only have to define some strict ordering of
348 348
        /// the items; this order has nothing to do with the iteration
349 349
        /// ordering of the items.
350 350
        bool operator<(Arc) const { return false; }
351 351

	
352
        /// Converison to Edge
353
        operator Edge() const { return Edge(); }
352 354
      };
353 355
      /// This iterator goes through each directed arc.
354 356

	
355 357
      /// This iterator goes through each arc of a graph.
356 358
      /// Its usage is quite simple, for example you can count the number
357 359
      /// of arcs in a graph \c g of type \c Graph as follows:
358 360
      ///\code
359 361
      /// int count=0;
360 362
      /// for(Graph::ArcIt e(g); e!=INVALID; ++e) ++count;
361 363
      ///\endcode
362 364
      class ArcIt : public Arc {
363 365
      public:
364 366
        /// Default constructor
365 367

	
366 368
        /// @warning The default constructor sets the iterator
367 369
        /// to an undefined value.
368 370
        ArcIt() { }
369 371
        /// Copy constructor.
370 372

	
371 373
        /// Copy constructor.
372 374
        ///
373 375
        ArcIt(const ArcIt& e) : Arc(e) { }
374 376
        /// Initialize the iterator to be invalid.
375 377

	
376 378
        /// Initialize the iterator to be invalid.
377 379
        ///
378 380
        ArcIt(Invalid) { }
379 381
        /// This constructor sets the iterator to the first arc.
380 382

	
381 383
        /// This constructor sets the iterator to the first arc of \c g.
382 384
        ///@param g the graph
383 385
        ArcIt(const Graph &g) { ignore_unused_variable_warning(g); }
384 386
        /// Arc -> ArcIt conversion
385 387

	
386 388
        /// Sets the iterator to the value of the trivial iterator \c e.
387 389
        /// This feature necessitates that each time we
388 390
        /// iterate the arc-set, the iteration order is the same.
389 391
        ArcIt(const Graph&, const Arc&) { }
390 392
        ///Next arc
391 393

	
392 394
        /// Assign the iterator to the next arc.
393 395
        ArcIt& operator++() { return *this; }
394 396
      };
395 397

	
396 398
      /// This iterator goes trough the outgoing directed arcs of a node.
397 399

	
398 400
      /// This iterator goes trough the \e outgoing arcs of a certain node
399 401
      /// of a graph.
400 402
      /// Its usage is quite simple, for example you can count the number
401 403
      /// of outgoing arcs of a node \c n
402 404
      /// in graph \c g of type \c Graph as follows.
403 405
      ///\code
404 406
      /// int count=0;
405 407
      /// for (Graph::OutArcIt e(g, n); e!=INVALID; ++e) ++count;
406 408
      ///\endcode
407 409

	
408 410
      class OutArcIt : public Arc {
409 411
      public:
410 412
        /// Default constructor
411 413

	
412 414
        /// @warning The default constructor sets the iterator
413 415
        /// to an undefined value.
414 416
        OutArcIt() { }
415 417
        /// Copy constructor.
416 418

	
417 419
        /// Copy constructor.
418 420
        ///
419 421
        OutArcIt(const OutArcIt& e) : Arc(e) { }
420 422
        /// Initialize the iterator to be invalid.
421 423

	
422 424
        /// Initialize the iterator to be invalid.
423 425
        ///
424 426
        OutArcIt(Invalid) { }
425 427
        /// This constructor sets the iterator to the first outgoing arc.
426 428

	
427 429
        /// This constructor sets the iterator to the first outgoing arc of
428 430
        /// the node.
429 431
        ///@param n the node
430 432
        ///@param g the graph
431 433
        OutArcIt(const Graph& n, const Node& g) {
432 434
          ignore_unused_variable_warning(n);
433 435
          ignore_unused_variable_warning(g);
434 436
        }
435 437
        /// Arc -> OutArcIt conversion
436 438

	
437 439
        /// Sets the iterator to the value of the trivial iterator.
438 440
        /// This feature necessitates that each time we
439 441
        /// iterate the arc-set, the iteration order is the same.
440 442
        OutArcIt(const Graph&, const Arc&) { }
441 443
        ///Next outgoing arc
442 444

	
443 445
        /// Assign the iterator to the next
444 446
        /// outgoing arc of the corresponding node.
445 447
        OutArcIt& operator++() { return *this; }
446 448
      };
447 449

	
448 450
      /// This iterator goes trough the incoming directed arcs of a node.
449 451

	
450 452
      /// This iterator goes trough the \e incoming arcs of a certain node
451 453
      /// of a graph.
452 454
      /// Its usage is quite simple, for example you can count the number
453 455
      /// of outgoing arcs of a node \c n
454 456
      /// in graph \c g of type \c Graph as follows.
455 457
      ///\code
456 458
      /// int count=0;
457 459
      /// for(Graph::InArcIt e(g, n); e!=INVALID; ++e) ++count;
458 460
      ///\endcode
459 461

	
460 462
      class InArcIt : public Arc {
461 463
      public:
462 464
        /// Default constructor
463 465

	
464 466
        /// @warning The default constructor sets the iterator
465 467
        /// to an undefined value.
466 468
        InArcIt() { }
467 469
        /// Copy constructor.
468 470

	
469 471
        /// Copy constructor.
470 472
        ///
471 473
        InArcIt(const InArcIt& e) : Arc(e) { }
472 474
        /// Initialize the iterator to be invalid.
473 475

	
474 476
        /// Initialize the iterator to be invalid.
475 477
        ///
476 478
        InArcIt(Invalid) { }
477 479
        /// This constructor sets the iterator to first incoming arc.
478 480

	
479 481
        /// This constructor set the iterator to the first incoming arc of
480 482
        /// the node.
481 483
        ///@param n the node
482 484
        ///@param g the graph
483 485
        InArcIt(const Graph& g, const Node& n) {
484 486
          ignore_unused_variable_warning(n);
485 487
          ignore_unused_variable_warning(g);
486 488
        }
487 489
        /// Arc -> InArcIt conversion
488 490

	
489 491
        /// Sets the iterator to the value of the trivial iterator \c e.
490 492
        /// This feature necessitates that each time we
491 493
        /// iterate the arc-set, the iteration order is the same.
492 494
        InArcIt(const Graph&, const Arc&) { }
493 495
        /// Next incoming arc
494 496

	
495 497
        /// Assign the iterator to the next inarc of the corresponding node.
496 498
        ///
497 499
        InArcIt& operator++() { return *this; }
498 500
      };
499 501

	
500 502
      /// \brief Reference map of the nodes to type \c T.
501 503
      ///
502 504
      /// Reference map of the nodes to type \c T.
503 505
      template<class T>
504 506
      class NodeMap : public ReferenceMap<Node, T, T&, const T&>
505 507
      {
506 508
      public:
507 509

	
508 510
        ///\e
509 511
        NodeMap(const Graph&) { }
510 512
        ///\e
511 513
        NodeMap(const Graph&, T) { }
512 514

	
513 515
      private:
514 516
        ///Copy constructor
515 517
        NodeMap(const NodeMap& nm) :
516 518
          ReferenceMap<Node, T, T&, const T&>(nm) { }
517 519
        ///Assignment operator
518 520
        template <typename CMap>
519 521
        NodeMap& operator=(const CMap&) {
520 522
          checkConcept<ReadMap<Node, T>, CMap>();
521 523
          return *this;
522 524
        }
523 525
      };
524 526

	
525 527
      /// \brief Reference map of the arcs to type \c T.
526 528
      ///
527 529
      /// Reference map of the arcs to type \c T.
528 530
      template<class T>
529 531
      class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
530 532
      {
531 533
      public:
532 534

	
533 535
        ///\e
534 536
        ArcMap(const Graph&) { }
535 537
        ///\e
536 538
        ArcMap(const Graph&, T) { }
537 539
      private:
538 540
        ///Copy constructor
539 541
        ArcMap(const ArcMap& em) :
540 542
          ReferenceMap<Arc, T, T&, const T&>(em) { }
541 543
        ///Assignment operator
542 544
        template <typename CMap>
543 545
        ArcMap& operator=(const CMap&) {
544 546
          checkConcept<ReadMap<Arc, T>, CMap>();
545 547
          return *this;
546 548
        }
547 549
      };
548 550

	
549 551
      /// Reference map of the edges to type \c T.
550 552

	
551 553
      /// Reference map of the edges to type \c T.
552 554
      template<class T>
553 555
      class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
554 556
      {
555 557
      public:
556 558

	
557 559
        ///\e
558 560
        EdgeMap(const Graph&) { }
559 561
        ///\e
560 562
        EdgeMap(const Graph&, T) { }
561 563
      private:
562 564
        ///Copy constructor
563 565
        EdgeMap(const EdgeMap& em) :
564 566
          ReferenceMap<Edge, T, T&, const T&>(em) {}
565 567
        ///Assignment operator
566 568
        template <typename CMap>
567 569
        EdgeMap& operator=(const CMap&) {
568 570
          checkConcept<ReadMap<Edge, T>, CMap>();
569 571
          return *this;
570 572
        }
571 573
      };
572 574

	
573 575
      /// \brief Direct the given edge.
574 576
      ///
575 577
      /// Direct the given edge. The returned arc source
576 578
      /// will be the given node.
577 579
      Arc direct(const Edge&, const Node&) const {
578 580
        return INVALID;
579 581
      }
580 582

	
581 583
      /// \brief Direct the given edge.
582 584
      ///
583 585
      /// Direct the given edge. The returned arc
584 586
      /// represents the given edge and the direction comes
585 587
      /// from the bool parameter. The source of the edge and
586 588
      /// the directed arc is the same when the given bool is true.
587 589
      Arc direct(const Edge&, bool) const {
588 590
        return INVALID;
589 591
      }
590 592

	
591 593
      /// \brief Returns true if the arc has default orientation.
592 594
      ///
593 595
      /// Returns whether the given directed arc is same orientation as
594 596
      /// the corresponding edge's default orientation.
595 597
      bool direction(Arc) const { return true; }
596 598

	
597 599
      /// \brief Returns the opposite directed arc.
598 600
      ///
599 601
      /// Returns the opposite directed arc.
600 602
      Arc oppositeArc(Arc) const { return INVALID; }
601 603

	
602 604
      /// \brief Opposite node on an arc
603 605
      ///
604 606
      /// \return The opposite of the given node on the given edge.
605 607
      Node oppositeNode(Node, Edge) const { return INVALID; }
606 608

	
607 609
      /// \brief First node of the edge.
608 610
      ///
609 611
      /// \return The first node of the given edge.
610 612
      ///
611 613
      /// Naturally edges don't have direction and thus
612 614
      /// don't have source and target node. However we use \c u() and \c v()
613 615
      /// methods to query the two nodes of the arc. The direction of the
614 616
      /// arc which arises this way is called the inherent direction of the
615 617
      /// edge, and is used to define the "default" direction
616 618
      /// of the directed versions of the arcs.
617 619
      /// \sa v()
618 620
      /// \sa direction()
619 621
      Node u(Edge) const { return INVALID; }
620 622

	
621 623
      /// \brief Second node of the edge.
622 624
      ///
623 625
      /// \return The second node of the given edge.
624 626
      ///
625 627
      /// Naturally edges don't have direction and thus
626 628
      /// don't have source and target node. However we use \c u() and \c v()
627 629
      /// methods to query the two nodes of the arc. The direction of the
628 630
      /// arc which arises this way is called the inherent direction of the
629 631
      /// edge, and is used to define the "default" direction
630 632
      /// of the directed versions of the arcs.
631 633
      /// \sa u()
632 634
      /// \sa direction()
633 635
      Node v(Edge) const { return INVALID; }
634 636

	
635 637
      /// \brief Source node of the directed arc.
636 638
      Node source(Arc) const { return INVALID; }
637 639

	
638 640
      /// \brief Target node of the directed arc.
639 641
      Node target(Arc) const { return INVALID; }
640 642

	
641 643
      /// \brief Returns the id of the node.
642 644
      int id(Node) const { return -1; }
643 645

	
644 646
      /// \brief Returns the id of the edge.
645 647
      int id(Edge) const { return -1; }
646 648

	
647 649
      /// \brief Returns the id of the arc.
648 650
      int id(Arc) const { return -1; }
649 651

	
650 652
      /// \brief Returns the node with the given id.
651 653
      ///
652 654
      /// \pre The argument should be a valid node id in the graph.
653 655
      Node nodeFromId(int) const { return INVALID; }
654 656

	
655 657
      /// \brief Returns the edge with the given id.
656 658
      ///
657 659
      /// \pre The argument should be a valid edge id in the graph.
658 660
      Edge edgeFromId(int) const { return INVALID; }
659 661

	
660 662
      /// \brief Returns the arc with the given id.
661 663
      ///
662 664
      /// \pre The argument should be a valid arc id in the graph.
663 665
      Arc arcFromId(int) const { return INVALID; }
664 666

	
665 667
      /// \brief Returns an upper bound on the node IDs.
666 668
      int maxNodeId() const { return -1; }
667 669

	
668 670
      /// \brief Returns an upper bound on the edge IDs.
669 671
      int maxEdgeId() const { return -1; }
670 672

	
671 673
      /// \brief Returns an upper bound on the arc IDs.
672 674
      int maxArcId() const { return -1; }
673 675

	
674 676
      void first(Node&) const {}
675 677
      void next(Node&) const {}
676 678

	
677 679
      void first(Edge&) const {}
678 680
      void next(Edge&) const {}
679 681

	
680 682
      void first(Arc&) const {}
681 683
      void next(Arc&) const {}
682 684

	
683 685
      void firstOut(Arc&, Node) const {}
684 686
      void nextOut(Arc&) const {}
685 687

	
686 688
      void firstIn(Arc&, Node) const {}
687 689
      void nextIn(Arc&) const {}
688 690

	
689 691
      void firstInc(Edge &, bool &, const Node &) const {}
690 692
      void nextInc(Edge &, bool &) const {}
691 693

	
692 694
      // The second parameter is dummy.
693 695
      Node fromId(int, Node) const { return INVALID; }
694 696
      // The second parameter is dummy.
695 697
      Edge fromId(int, Edge) const { return INVALID; }
696 698
      // The second parameter is dummy.
697 699
      Arc fromId(int, Arc) const { return INVALID; }
698 700

	
699 701
      // Dummy parameter.
700 702
      int maxId(Node) const { return -1; }
701 703
      // Dummy parameter.
702 704
      int maxId(Edge) const { return -1; }
703 705
      // Dummy parameter.
704 706
      int maxId(Arc) const { return -1; }
705 707

	
706 708
      /// \brief Base node of the iterator
707 709
      ///
708 710
      /// Returns the base node (the source in this case) of the iterator
709 711
      Node baseNode(OutArcIt e) const {
710 712
        return source(e);
711 713
      }
712 714
      /// \brief Running node of the iterator
713 715
      ///
714 716
      /// Returns the running node (the target in this case) of the
715 717
      /// iterator
716 718
      Node runningNode(OutArcIt e) const {
717 719
        return target(e);
718 720
      }
719 721

	
720 722
      /// \brief Base node of the iterator
721 723
      ///
722 724
      /// Returns the base node (the target in this case) of the iterator
723 725
      Node baseNode(InArcIt e) const {
724 726
        return target(e);
725 727
      }
726 728
      /// \brief Running node of the iterator
727 729
      ///
728 730
      /// Returns the running node (the source in this case) of the
729 731
      /// iterator
730 732
      Node runningNode(InArcIt e) const {
731 733
        return source(e);
732 734
      }
733 735

	
734 736
      /// \brief Base node of the iterator
735 737
      ///
0 comments (0 inline)