gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Renaming types and variables
0 3 0
default
3 files changed with 146 insertions and 146 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
1 1
/* -*- C++ -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library
4 4
 *
5 5
 * Copyright (C) 2003-2007
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
#ifndef LEMON_BITS_GRAPH_EXTENDER_H
20 20
#define LEMON_BITS_GRAPH_EXTENDER_H
21 21

	
22 22
#include <lemon/bits/invalid.h>
23 23
#include <lemon/bits/utility.h>
24 24

	
25 25
#include <lemon/bits/map_extender.h>
26 26
#include <lemon/bits/default_map.h>
27 27

	
28 28
#include <lemon/concept_check.h>
29 29
#include <lemon/concepts/maps.h>
30 30

	
31 31
///\ingroup graphbits
32 32
///\file
33 33
///\brief Extenders for the digraph types
34 34
namespace lemon {
35 35

	
36 36
  /// \ingroup graphbits
37 37
  ///
38 38
  /// \brief Extender for the Digraphs
39 39
  template <typename Base>
40 40
  class DigraphExtender : public Base {
41 41
  public:
42 42

	
43 43
    typedef Base Parent;
44 44
    typedef DigraphExtender Digraph;
45 45

	
46 46
    // Base extensions
47 47

	
48 48
    typedef typename Parent::Node Node;
49 49
    typedef typename Parent::Arc Arc;
50 50

	
51 51
    int maxId(Node) const {
52 52
      return Parent::maxNodeId();
53 53
    }
54 54

	
55 55
    int maxId(Arc) const {
56 56
      return Parent::maxArcId();
57 57
    }
58 58

	
59 59
    Node fromId(int id, Node) const {
60 60
      return Parent::nodeFromId(id);
61 61
    }
62 62

	
63 63
    Arc fromId(int id, Arc) const {
64 64
      return Parent::arcFromId(id);
65 65
    }
66 66

	
67
    Node oppositeNode(const Node &n, const Arc &e) const {
68
      if (n == Parent::source(e))
69
	return Parent::target(e);
70
      else if(n==Parent::target(e))
71
	return Parent::source(e);
67
    Node oppositeNode(const Node &node, const Arc &arc) const {
68
      if (node == Parent::source(arc))
69
	return Parent::target(arc);
70
      else if(node == Parent::target(arc))
71
	return Parent::source(arc);
72 72
      else
73 73
	return INVALID;
74 74
    }
75 75

	
76 76
    // Alterable extension
77 77

	
78 78
    typedef AlterationNotifier<DigraphExtender, Node> NodeNotifier;
79 79
    typedef AlterationNotifier<DigraphExtender, Arc> ArcNotifier;
80 80

	
81 81

	
82 82
  protected:
83 83

	
84 84
    mutable NodeNotifier node_notifier;
85 85
    mutable ArcNotifier arc_notifier;
86 86

	
87 87
  public:
88 88

	
89 89
    NodeNotifier& notifier(Node) const {
90 90
      return node_notifier;
91 91
    }
92 92
    
93 93
    ArcNotifier& notifier(Arc) const {
94 94
      return arc_notifier;
95 95
    }
96 96

	
97 97
    class NodeIt : public Node { 
98
      const Digraph* digraph;
98
      const Digraph* _digraph;
99 99
    public:
100 100

	
101 101
      NodeIt() {}
102 102

	
103 103
      NodeIt(Invalid i) : Node(i) { }
104 104

	
105
      explicit NodeIt(const Digraph& _digraph) : digraph(&_digraph) {
106
	_digraph.first(static_cast<Node&>(*this));
105
      explicit NodeIt(const Digraph& digraph) : _digraph(&digraph) {
106
	_digraph->first(static_cast<Node&>(*this));
107 107
      }
108 108

	
109
      NodeIt(const Digraph& _digraph, const Node& node) 
110
	: Node(node), digraph(&_digraph) {}
109
      NodeIt(const Digraph& digraph, const Node& node) 
110
	: Node(node), _digraph(&digraph) {}
111 111

	
112 112
      NodeIt& operator++() { 
113
	digraph->next(*this);
113
	_digraph->next(*this);
114 114
	return *this; 
115 115
      }
116 116

	
117 117
    };
118 118

	
119 119

	
120 120
    class ArcIt : public Arc { 
121
      const Digraph* digraph;
121
      const Digraph* _digraph;
122 122
    public:
123 123

	
124 124
      ArcIt() { }
125 125

	
126 126
      ArcIt(Invalid i) : Arc(i) { }
127 127

	
128
      explicit ArcIt(const Digraph& _digraph) : digraph(&_digraph) {
129
	_digraph.first(static_cast<Arc&>(*this));
128
      explicit ArcIt(const Digraph& digraph) : _digraph(&digraph) {
129
	_digraph->first(static_cast<Arc&>(*this));
130 130
      }
131 131

	
132
      ArcIt(const Digraph& _digraph, const Arc& e) : 
133
	Arc(e), digraph(&_digraph) { }
132
      ArcIt(const Digraph& digraph, const Arc& arc) : 
133
	Arc(arc), _digraph(&digraph) { }
134 134

	
135 135
      ArcIt& operator++() { 
136
	digraph->next(*this);
136
	_digraph->next(*this);
137 137
	return *this; 
138 138
      }
139 139

	
140 140
    };
141 141

	
142 142

	
143 143
    class OutArcIt : public Arc { 
144
      const Digraph* digraph;
144
      const Digraph* _digraph;
145 145
    public:
146 146

	
147 147
      OutArcIt() { }
148 148

	
149 149
      OutArcIt(Invalid i) : Arc(i) { }
150 150

	
151
      OutArcIt(const Digraph& _digraph, const Node& node) 
152
	: digraph(&_digraph) {
153
	_digraph.firstOut(*this, node);
151
      OutArcIt(const Digraph& digraph, const Node& node) 
152
	: _digraph(&digraph) {
153
	_digraph->firstOut(*this, node);
154 154
      }
155 155

	
156
      OutArcIt(const Digraph& _digraph, const Arc& arc) 
157
	: Arc(arc), digraph(&_digraph) {}
156
      OutArcIt(const Digraph& digraph, const Arc& arc) 
157
	: Arc(arc), _digraph(&digraph) {}
158 158

	
159 159
      OutArcIt& operator++() { 
160
	digraph->nextOut(*this);
160
	_digraph->nextOut(*this);
161 161
	return *this; 
162 162
      }
163 163

	
164 164
    };
165 165

	
166 166

	
167 167
    class InArcIt : public Arc { 
168
      const Digraph* digraph;
168
      const Digraph* _digraph;
169 169
    public:
170 170

	
171 171
      InArcIt() { }
172 172

	
173 173
      InArcIt(Invalid i) : Arc(i) { }
174 174

	
175
      InArcIt(const Digraph& _digraph, const Node& node) 
176
	: digraph(&_digraph) {
177
	_digraph.firstIn(*this, node);
175
      InArcIt(const Digraph& digraph, const Node& node) 
176
	: _digraph(&digraph) {
177
	_digraph->firstIn(*this, node);
178 178
      }
179 179

	
180
      InArcIt(const Digraph& _digraph, const Arc& arc) : 
181
	Arc(arc), digraph(&_digraph) {}
180
      InArcIt(const Digraph& digraph, const Arc& arc) : 
181
	Arc(arc), _digraph(&digraph) {}
182 182

	
183 183
      InArcIt& operator++() { 
184
	digraph->nextIn(*this);
184
	_digraph->nextIn(*this);
185 185
	return *this; 
186 186
      }
187 187

	
188 188
    };
189 189

	
190 190
    /// \brief Base node of the iterator
191 191
    ///
192 192
    /// Returns the base node (i.e. the source in this case) of the iterator
193
    Node baseNode(const OutArcIt &e) const {
194
      return Parent::source(e);
193
    Node baseNode(const OutArcIt &arc) const {
194
      return Parent::source(arc);
195 195
    }
196 196
    /// \brief Running node of the iterator
197 197
    ///
198 198
    /// Returns the running node (i.e. the target in this case) of the
199 199
    /// iterator
200
    Node runningNode(const OutArcIt &e) const {
201
      return Parent::target(e);
200
    Node runningNode(const OutArcIt &arc) const {
201
      return Parent::target(arc);
202 202
    }
203 203

	
204 204
    /// \brief Base node of the iterator
205 205
    ///
206 206
    /// Returns the base node (i.e. the target in this case) of the iterator
207
    Node baseNode(const InArcIt &e) const {
208
      return Parent::target(e);
207
    Node baseNode(const InArcIt &arc) const {
208
      return Parent::target(arc);
209 209
    }
210 210
    /// \brief Running node of the iterator
211 211
    ///
212 212
    /// Returns the running node (i.e. the source in this case) of the
213 213
    /// iterator
214
    Node runningNode(const InArcIt &e) const {
215
      return Parent::source(e);
214
    Node runningNode(const InArcIt &arc) const {
215
      return Parent::source(arc);
216 216
    }
217 217

	
218 218
    
219 219
    template <typename _Value>
220 220
    class NodeMap 
221 221
      : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
222 222
    public:
223 223
      typedef DigraphExtender Digraph;
224 224
      typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
225 225

	
226 226
      explicit NodeMap(const Digraph& digraph) 
227 227
	: Parent(digraph) {}
228 228
      NodeMap(const Digraph& digraph, const _Value& value) 
229 229
	: Parent(digraph, value) {}
230 230

	
231 231
      NodeMap& operator=(const NodeMap& cmap) {
232 232
	return operator=<NodeMap>(cmap);
233 233
      }
234 234

	
235 235
      template <typename CMap>
236 236
      NodeMap& operator=(const CMap& cmap) {
237 237
        Parent::operator=(cmap);
238 238
	return *this;
239 239
      }
240 240

	
241 241
    };
242 242

	
243 243
    template <typename _Value>
244 244
    class ArcMap 
245 245
      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
246 246
    public:
247 247
      typedef DigraphExtender Digraph;
248 248
      typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
249 249

	
250 250
      explicit ArcMap(const Digraph& digraph) 
251 251
	: Parent(digraph) {}
252 252
      ArcMap(const Digraph& digraph, const _Value& value) 
253 253
	: Parent(digraph, value) {}
254 254

	
255 255
      ArcMap& operator=(const ArcMap& cmap) {
256 256
	return operator=<ArcMap>(cmap);
257 257
      }
258 258

	
259 259
      template <typename CMap>
260 260
      ArcMap& operator=(const CMap& cmap) {
261 261
        Parent::operator=(cmap);
262 262
	return *this;
263 263
      }
264 264
    };
265 265

	
266 266

	
267 267
    Node addNode() {
268 268
      Node node = Parent::addNode();
269 269
      notifier(Node()).add(node);
270 270
      return node;
271 271
    }
272 272
    
273 273
    Arc addArc(const Node& from, const Node& to) {
274 274
      Arc arc = Parent::addArc(from, to);
275 275
      notifier(Arc()).add(arc);
276 276
      return arc;
277 277
    }
278 278

	
279 279
    void clear() {
280 280
      notifier(Arc()).clear();
281 281
      notifier(Node()).clear();
282 282
      Parent::clear();
283 283
    }
284 284

	
285 285
    template <typename Digraph, typename NodeRefMap, typename ArcRefMap>
286 286
    void build(const Digraph& digraph, NodeRefMap& nodeRef, ArcRefMap& arcRef) {
287 287
      Parent::build(digraph, nodeRef, arcRef);
288 288
      notifier(Node()).build();
289 289
      notifier(Arc()).build();
290 290
    }
291 291

	
292 292
    void erase(const Node& node) {
293 293
      Arc arc;
294 294
      Parent::firstOut(arc, node);
295 295
      while (arc != INVALID ) {
296 296
	erase(arc);
297 297
	Parent::firstOut(arc, node);
298 298
      } 
299 299

	
300 300
      Parent::firstIn(arc, node);
301 301
      while (arc != INVALID ) {
302 302
	erase(arc);
303 303
	Parent::firstIn(arc, node);
304 304
      }
305 305

	
306 306
      notifier(Node()).erase(node);
307 307
      Parent::erase(node);
308 308
    }
309 309
    
310 310
    void erase(const Arc& arc) {
311 311
      notifier(Arc()).erase(arc);
312 312
      Parent::erase(arc);
313 313
    }
314 314

	
315 315
    DigraphExtender() {
316 316
      node_notifier.setContainer(*this);
317 317
      arc_notifier.setContainer(*this);
318 318
    } 
319 319
    
320 320

	
321 321
    ~DigraphExtender() {
322 322
      arc_notifier.clear();
323 323
      node_notifier.clear();
324 324
    }
325 325
  };
326 326

	
327
  /// \ingroup graphbits
327
  /// \ingroup _graphbits
328 328
  ///
329 329
  /// \brief Extender for the Graphs
330 330
  template <typename Base> 
331 331
  class GraphExtender : public Base {
332 332
  public:
333 333
    
334 334
    typedef Base Parent;
335
    typedef GraphExtender Digraph;
335
    typedef GraphExtender Graph;
336 336

	
337 337
    typedef True UndirectedTag;
338 338

	
339 339
    typedef typename Parent::Node Node;
340 340
    typedef typename Parent::Arc Arc;
341 341
    typedef typename Parent::Edge Edge;
342 342

	
343 343
    // Graph extension    
344 344

	
345 345
    int maxId(Node) const {
346 346
      return Parent::maxNodeId();
347 347
    }
348 348

	
349 349
    int maxId(Arc) const {
350 350
      return Parent::maxArcId();
351 351
    }
352 352

	
353 353
    int maxId(Edge) const {
354 354
      return Parent::maxEdgeId();
355 355
    }
356 356

	
357 357
    Node fromId(int id, Node) const {
358 358
      return Parent::nodeFromId(id);
359 359
    }
360 360

	
361 361
    Arc fromId(int id, Arc) const {
362 362
      return Parent::arcFromId(id);
363 363
    }
364 364

	
365 365
    Edge fromId(int id, Edge) const {
366 366
      return Parent::edgeFromId(id);
367 367
    }
368 368

	
369 369
    Node oppositeNode(const Node &n, const Edge &e) const {
370 370
      if( n == Parent::source(e))
371 371
	return Parent::target(e);
372 372
      else if( n == Parent::target(e))
373 373
	return Parent::source(e);
374 374
      else
375 375
	return INVALID;
376 376
    }
377 377

	
378
    Arc oppositeArc(const Arc &e) const {
379
      return Parent::direct(e, !Parent::direction(e));
378
    Arc oppositeArc(const Arc &arc) const {
379
      return Parent::direct(arc, !Parent::direction(arc));
380 380
    }
381 381

	
382 382
    using Parent::direct;
383
    Arc direct(const Edge &ue, const Node &s) const {
384
      return Parent::direct(ue, Parent::source(ue) == s);
383
    Arc direct(const Edge &edge, const Node &node) const {
384
      return Parent::direct(edge, Parent::source(edge) == node);
385 385
    }
386 386

	
387 387
    // Alterable extension
388 388

	
389 389
    typedef AlterationNotifier<GraphExtender, Node> NodeNotifier;
390 390
    typedef AlterationNotifier<GraphExtender, Arc> ArcNotifier;
391 391
    typedef AlterationNotifier<GraphExtender, Edge> EdgeNotifier;
392 392

	
393 393

	
394 394
  protected:
395 395

	
396 396
    mutable NodeNotifier node_notifier;
397 397
    mutable ArcNotifier arc_notifier;
398 398
    mutable EdgeNotifier edge_notifier;
399 399

	
400 400
  public:
401 401

	
402 402
    NodeNotifier& notifier(Node) const {
403 403
      return node_notifier;
404 404
    }
405 405
    
406 406
    ArcNotifier& notifier(Arc) const {
407 407
      return arc_notifier;
408 408
    }
409 409

	
410 410
    EdgeNotifier& notifier(Edge) const {
411 411
      return edge_notifier;
412 412
    }
413 413

	
414 414

	
415 415

	
416 416
    class NodeIt : public Node { 
417
      const Digraph* digraph;
417
      const Graph* _graph;
418 418
    public:
419 419

	
420 420
      NodeIt() {}
421 421

	
422 422
      NodeIt(Invalid i) : Node(i) { }
423 423

	
424
      explicit NodeIt(const Digraph& _digraph) : digraph(&_digraph) {
425
	_digraph.first(static_cast<Node&>(*this));
424
      explicit NodeIt(const Graph& graph) : _graph(&graph) {
425
	_graph->first(static_cast<Node&>(*this));
426 426
      }
427 427

	
428
      NodeIt(const Digraph& _digraph, const Node& node) 
429
	: Node(node), digraph(&_digraph) {}
428
      NodeIt(const Graph& graph, const Node& node) 
429
	: Node(node), _graph(&graph) {}
430 430

	
431 431
      NodeIt& operator++() { 
432
	digraph->next(*this);
432
	_graph->next(*this);
433 433
	return *this; 
434 434
      }
435 435

	
436 436
    };
437 437

	
438 438

	
439 439
    class ArcIt : public Arc { 
440
      const Digraph* digraph;
440
      const Graph* _graph;
441 441
    public:
442 442

	
443 443
      ArcIt() { }
444 444

	
445 445
      ArcIt(Invalid i) : Arc(i) { }
446 446

	
447
      explicit ArcIt(const Digraph& _digraph) : digraph(&_digraph) {
448
	_digraph.first(static_cast<Arc&>(*this));
447
      explicit ArcIt(const Graph& graph) : _graph(&graph) {
448
	_graph->first(static_cast<Arc&>(*this));
449 449
      }
450 450

	
451
      ArcIt(const Digraph& _digraph, const Arc& e) : 
452
	Arc(e), digraph(&_digraph) { }
451
      ArcIt(const Graph& graph, const Arc& arc) : 
452
	Arc(arc), _graph(&graph) { }
453 453

	
454 454
      ArcIt& operator++() { 
455
	digraph->next(*this);
455
	_graph->next(*this);
456 456
	return *this; 
457 457
      }
458 458

	
459 459
    };
460 460

	
461 461

	
462 462
    class OutArcIt : public Arc { 
463
      const Digraph* digraph;
463
      const Graph* _graph;
464 464
    public:
465 465

	
466 466
      OutArcIt() { }
467 467

	
468 468
      OutArcIt(Invalid i) : Arc(i) { }
469 469

	
470
      OutArcIt(const Digraph& _digraph, const Node& node) 
471
	: digraph(&_digraph) {
472
	_digraph.firstOut(*this, node);
470
      OutArcIt(const Graph& graph, const Node& node) 
471
	: _graph(&graph) {
472
	_graph->firstOut(*this, node);
473 473
      }
474 474

	
475
      OutArcIt(const Digraph& _digraph, const Arc& arc) 
476
	: Arc(arc), digraph(&_digraph) {}
475
      OutArcIt(const Graph& graph, const Arc& arc) 
476
	: Arc(arc), _graph(&graph) {}
477 477

	
478 478
      OutArcIt& operator++() { 
479
	digraph->nextOut(*this);
479
	_graph->nextOut(*this);
480 480
	return *this; 
481 481
      }
482 482

	
483 483
    };
484 484

	
485 485

	
486 486
    class InArcIt : public Arc { 
487
      const Digraph* digraph;
487
      const Graph* _graph;
488 488
    public:
489 489

	
490 490
      InArcIt() { }
491 491

	
492 492
      InArcIt(Invalid i) : Arc(i) { }
493 493

	
494
      InArcIt(const Digraph& _digraph, const Node& node) 
495
	: digraph(&_digraph) {
496
	_digraph.firstIn(*this, node);
494
      InArcIt(const Graph& graph, const Node& node) 
495
	: _graph(&graph) {
496
	_graph->firstIn(*this, node);
497 497
      }
498 498

	
499
      InArcIt(const Digraph& _digraph, const Arc& arc) : 
500
	Arc(arc), digraph(&_digraph) {}
499
      InArcIt(const Graph& graph, const Arc& arc) : 
500
	Arc(arc), _graph(&graph) {}
501 501

	
502 502
      InArcIt& operator++() { 
503
	digraph->nextIn(*this);
503
	_graph->nextIn(*this);
504 504
	return *this; 
505 505
      }
506 506

	
507 507
    };
508 508

	
509 509

	
510 510
    class EdgeIt : public Parent::Edge { 
511
      const Digraph* digraph;
511
      const Graph* _graph;
512 512
    public:
513 513

	
514 514
      EdgeIt() { }
515 515

	
516 516
      EdgeIt(Invalid i) : Edge(i) { }
517 517

	
518
      explicit EdgeIt(const Digraph& _digraph) : digraph(&_digraph) {
519
	_digraph.first(static_cast<Edge&>(*this));
518
      explicit EdgeIt(const Graph& graph) : _graph(&graph) {
519
	_graph->first(static_cast<Edge&>(*this));
520 520
      }
521 521

	
522
      EdgeIt(const Digraph& _digraph, const Edge& e) : 
523
	Edge(e), digraph(&_digraph) { }
522
      EdgeIt(const Graph& graph, const Edge& edge) : 
523
	Edge(edge), _graph(&graph) { }
524 524

	
525 525
      EdgeIt& operator++() { 
526
	digraph->next(*this);
526
	_graph->next(*this);
527 527
	return *this; 
528 528
      }
529 529

	
530 530
    };
531 531

	
532
    class IncArcIt : public Parent::Edge {
532
    class IncEdgeIt : public Parent::Edge {
533 533
      friend class GraphExtender;
534
      const Digraph* digraph;
535
      bool direction;
534
      const Graph* _graph;
535
      bool _direction;
536 536
    public:
537 537

	
538
      IncArcIt() { }
538
      IncEdgeIt() { }
539 539

	
540
      IncArcIt(Invalid i) : Edge(i), direction(false) { }
540
      IncEdgeIt(Invalid i) : Edge(i), _direction(false) { }
541 541

	
542
      IncArcIt(const Digraph& _digraph, const Node &n) : digraph(&_digraph) {
543
	_digraph.firstInc(*this, direction, n);
542
      IncEdgeIt(const Graph& graph, const Node &node) : _graph(&graph) {
543
	_graph->firstInc(*this, _direction, node);
544 544
      }
545 545

	
546
      IncArcIt(const Digraph& _digraph, const Edge &ue, const Node &n)
547
	: digraph(&_digraph), Edge(ue) {
548
	direction = (_digraph.source(ue) == n);
546
      IncEdgeIt(const Graph& graph, const Edge &edge, const Node &node)
547
	: _graph(&graph), Edge(edge) {
548
	_direction = (_graph->source(edge) == node);
549 549
      }
550 550

	
551
      IncArcIt& operator++() {
552
	digraph->nextInc(*this, direction);
551
      IncEdgeIt& operator++() {
552
	_graph->nextInc(*this, _direction);
553 553
	return *this; 
554 554
      }
555 555
    };
556 556

	
557 557
    /// \brief Base node of the iterator
558 558
    ///
559 559
    /// Returns the base node (ie. the source in this case) of the iterator
560
    Node baseNode(const OutArcIt &e) const {
561
      return Parent::source(static_cast<const Arc&>(e));
560
    Node baseNode(const OutArcIt &arc) const {
561
      return Parent::source(static_cast<const Arc&>(arc));
562 562
    }
563 563
    /// \brief Running node of the iterator
564 564
    ///
565 565
    /// Returns the running node (ie. the target in this case) of the
566 566
    /// iterator
567
    Node runningNode(const OutArcIt &e) const {
568
      return Parent::target(static_cast<const Arc&>(e));
567
    Node runningNode(const OutArcIt &arc) const {
568
      return Parent::target(static_cast<const Arc&>(arc));
569 569
    }
570 570

	
571 571
    /// \brief Base node of the iterator
572 572
    ///
573 573
    /// Returns the base node (ie. the target in this case) of the iterator
574
    Node baseNode(const InArcIt &e) const {
575
      return Parent::target(static_cast<const Arc&>(e));
574
    Node baseNode(const InArcIt &arc) const {
575
      return Parent::target(static_cast<const Arc&>(arc));
576 576
    }
577 577
    /// \brief Running node of the iterator
578 578
    ///
579 579
    /// Returns the running node (ie. the source in this case) of the
580 580
    /// iterator
581
    Node runningNode(const InArcIt &e) const {
582
      return Parent::source(static_cast<const Arc&>(e));
581
    Node runningNode(const InArcIt &arc) const {
582
      return Parent::source(static_cast<const Arc&>(arc));
583 583
    }
584 584

	
585 585
    /// Base node of the iterator
586 586
    ///
587 587
    /// Returns the base node of the iterator
588
    Node baseNode(const IncArcIt &e) const {
589
      return e.direction ? source(e) : target(e);
588
    Node baseNode(const IncEdgeIt &edge) const {
589
      return edge._direction ? source(edge) : target(edge);
590 590
    }
591 591
    /// Running node of the iterator
592 592
    ///
593 593
    /// Returns the running node of the iterator
594
    Node runningNode(const IncArcIt &e) const {
595
      return e.direction ? target(e) : source(e);
594
    Node runningNode(const IncEdgeIt &edge) const {
595
      return edge._direction ? target(edge) : source(edge);
596 596
    }
597 597

	
598 598
    // Mappable extension
599 599

	
600 600
    template <typename _Value>
601 601
    class NodeMap 
602
      : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
602
      : public MapExtender<DefaultMap<Graph, Node, _Value> > {
603 603
    public:
604
      typedef GraphExtender Digraph;
605
      typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
604
      typedef GraphExtender Graph;
605
      typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
606 606

	
607
      NodeMap(const Digraph& digraph) 
608
	: Parent(digraph) {}
609
      NodeMap(const Digraph& digraph, const _Value& value) 
610
	: Parent(digraph, value) {}
607
      NodeMap(const Graph& graph) 
608
	: Parent(graph) {}
609
      NodeMap(const Graph& graph, const _Value& value) 
610
	: Parent(graph, value) {}
611 611

	
612 612
      NodeMap& operator=(const NodeMap& cmap) {
613 613
	return operator=<NodeMap>(cmap);
614 614
      }
615 615

	
616 616
      template <typename CMap>
617 617
      NodeMap& operator=(const CMap& cmap) {
618 618
        Parent::operator=(cmap);
619 619
	return *this;
620 620
      }
621 621

	
622 622
    };
623 623

	
624 624
    template <typename _Value>
625 625
    class ArcMap 
626
      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
626
      : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
627 627
    public:
628
      typedef GraphExtender Digraph;
629
      typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
628
      typedef GraphExtender Graph;
629
      typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
630 630

	
631
      ArcMap(const Digraph& digraph) 
632
	: Parent(digraph) {}
633
      ArcMap(const Digraph& digraph, const _Value& value) 
634
	: Parent(digraph, value) {}
631
      ArcMap(const Graph& graph) 
632
	: Parent(graph) {}
633
      ArcMap(const Graph& graph, const _Value& value) 
634
	: Parent(graph, value) {}
635 635

	
636 636
      ArcMap& operator=(const ArcMap& cmap) {
637 637
	return operator=<ArcMap>(cmap);
638 638
      }
639 639

	
640 640
      template <typename CMap>
641 641
      ArcMap& operator=(const CMap& cmap) {
642 642
        Parent::operator=(cmap);
643 643
	return *this;
644 644
      }
645 645
    };
646 646

	
647 647

	
648 648
    template <typename _Value>
649 649
    class EdgeMap 
650
      : public MapExtender<DefaultMap<Digraph, Edge, _Value> > {
650
      : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
651 651
    public:
652
      typedef GraphExtender Digraph;
653
      typedef MapExtender<DefaultMap<Digraph, Edge, _Value> > Parent;
652
      typedef GraphExtender Graph;
653
      typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
654 654

	
655
      EdgeMap(const Digraph& digraph) 
656
	: Parent(digraph) {}
655
      EdgeMap(const Graph& graph) 
656
	: Parent(graph) {}
657 657

	
658
      EdgeMap(const Digraph& digraph, const _Value& value) 
659
	: Parent(digraph, value) {}
658
      EdgeMap(const Graph& graph, const _Value& value) 
659
	: Parent(graph, value) {}
660 660

	
661 661
      EdgeMap& operator=(const EdgeMap& cmap) {
662 662
	return operator=<EdgeMap>(cmap);
663 663
      }
664 664

	
665 665
      template <typename CMap>
666 666
      EdgeMap& operator=(const CMap& cmap) {
667 667
        Parent::operator=(cmap);
668 668
	return *this;
669 669
      }
670 670

	
671 671
    };
672 672

	
673 673
    // Alteration extension
674 674

	
675 675
    Node addNode() {
676 676
      Node node = Parent::addNode();
677 677
      notifier(Node()).add(node);
678 678
      return node;
679 679
    }
680 680

	
681 681
    Edge addEdge(const Node& from, const Node& to) {
682 682
      Edge edge = Parent::addEdge(from, to);
683 683
      notifier(Edge()).add(edge);
684 684
      std::vector<Arc> ev;
685 685
      ev.push_back(Parent::direct(edge, true));
686 686
      ev.push_back(Parent::direct(edge, false));      
687 687
      notifier(Arc()).add(ev);
688 688
      return edge;
689 689
    }
690 690
    
691 691
    void clear() {
692 692
      notifier(Arc()).clear();
693 693
      notifier(Edge()).clear();
694 694
      notifier(Node()).clear();
695 695
      Parent::clear();
696 696
    }
697 697

	
698
    template <typename Digraph, typename NodeRefMap, typename EdgeRefMap>
699
    void build(const Digraph& digraph, NodeRefMap& nodeRef, 
698
    template <typename Graph, typename NodeRefMap, typename EdgeRefMap>
699
    void build(const Graph& graph, NodeRefMap& nodeRef, 
700 700
               EdgeRefMap& edgeRef) {
701
      Parent::build(digraph, nodeRef, edgeRef);
701
      Parent::build(graph, nodeRef, edgeRef);
702 702
      notifier(Node()).build();
703 703
      notifier(Edge()).build();
704 704
      notifier(Arc()).build();
705 705
    }
706 706

	
707 707
    void erase(const Node& node) {
708 708
      Arc arc;
709 709
      Parent::firstOut(arc, node);
710 710
      while (arc != INVALID ) {
711 711
	erase(arc);
712 712
	Parent::firstOut(arc, node);
713 713
      } 
714 714

	
715 715
      Parent::firstIn(arc, node);
716 716
      while (arc != INVALID ) {
717 717
	erase(arc);
718 718
	Parent::firstIn(arc, node);
719 719
      }
720 720

	
721 721
      notifier(Node()).erase(node);
722 722
      Parent::erase(node);
723 723
    }
724 724

	
725 725
    void erase(const Edge& edge) {
726
      std::vector<Arc> ev;
727
      ev.push_back(Parent::direct(edge, true));
728
      ev.push_back(Parent::direct(edge, false));      
729
      notifier(Arc()).erase(ev);
726
      std::vector<Arc> av;
727
      av.push_back(Parent::direct(edge, true));
728
      av.push_back(Parent::direct(edge, false));      
729
      notifier(Arc()).erase(av);
730 730
      notifier(Edge()).erase(edge);
731 731
      Parent::erase(edge);
732 732
    }
733 733

	
734 734
    GraphExtender() {
735 735
      node_notifier.setContainer(*this); 
736 736
      arc_notifier.setContainer(*this);
737 737
      edge_notifier.setContainer(*this);
738 738
    } 
739 739

	
740 740
    ~GraphExtender() {
741 741
      edge_notifier.clear();
742 742
      arc_notifier.clear();
743 743
      node_notifier.clear(); 
744 744
    } 
745 745

	
746 746
  };
747 747

	
748 748
}
749 749

	
750 750
#endif
Ignore white space 6 line context
1 1
/* -*- C++ -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library
4 4
 *
5 5
 * Copyright (C) 2003-2007
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_CONCEPT_GRAPH_H
24 24
#define LEMON_CONCEPT_GRAPH_H
25 25

	
26 26
#include <lemon/concepts/graph_components.h>
27 27
#include <lemon/concepts/graph.h>
28 28
#include <lemon/bits/utility.h>
29 29

	
30 30
namespace lemon {
31 31
  namespace concepts {
32 32

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

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

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

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

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

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

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

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

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

	
126 126
      };
127 127
    
128 128
      /// This iterator goes through each node.
129 129

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

	
141 141
        /// @warning The default constructor sets the iterator
142 142
        /// to an undefined value.
143 143
        NodeIt() { }
144 144
        /// Copy constructor.
145 145
        
146 146
        /// Copy constructor.
147 147
        ///
148 148
        NodeIt(const NodeIt& n) : Node(n) { }
149 149
        /// Invalid constructor \& conversion.
150 150

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

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

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

	
168 168
        /// Assign the iterator to the next node.
169 169
        ///
170 170
        NodeIt& operator++() { return *this; }
171 171
      };
172 172
    
173 173
    
174 174
      /// The base type of the edge iterators.
175 175

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

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

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

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

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

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

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

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

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

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

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

	
240 240
        /// Initialize the iterator to be invalid.
241 241
        ///
242 242
        EdgeIt(Invalid) { }
243 243
        /// This constructor sets the iterator to the first edge.
244 244
    
245 245
        /// This constructor sets the iterator to the first edge.
246 246
        EdgeIt(const Graph&) { }
247 247
        /// Edge -> EdgeIt conversion
248 248

	
249 249
        /// Sets the iterator to the value of the trivial iterator.
250 250
        /// This feature necessitates that each time we
251 251
        /// iterate the edge-set, the iteration order is the 
252 252
	/// same.
253 253
        EdgeIt(const Graph&, const Edge&) { } 
254 254
        /// Next edge
255 255
        
256 256
        /// Assign the iterator to the next edge.
257 257
        EdgeIt& operator++() { return *this; }
258 258
      };
259 259

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

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

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

	
289 289
        /// Initialize the iterator to be invalid.
290 290
        ///
291
        IncArcIt(Invalid) { }
291
        IncEdgeIt(Invalid) { }
292 292
        /// This constructor sets the iterator to first incident arc.
293 293
    
294 294
        /// This constructor set the iterator to the first incident arc of
295 295
        /// the node.
296
        IncArcIt(const Graph&, const Node&) { }
297
        /// Edge -> IncArcIt conversion
296
        IncEdgeIt(const Graph&, const Node&) { }
297
        /// Edge -> IncEdgeIt conversion
298 298

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

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

	
310 310
      /// The directed arc type.
311 311

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

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

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

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

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

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

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

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

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

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

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

	
387 387
        /// Sets the iterator to the value of the trivial iterator \c e.
388 388
        /// This feature necessitates that each time we 
389 389
        /// iterate the arc-set, the iteration order is the same.
390 390
        ArcIt(const Graph&, const Arc&) { } 
391 391
        ///Next arc
392 392
        
393 393
        /// Assign the iterator to the next arc.
394 394
        ArcIt& operator++() { return *this; }
395 395
      };
396 396
   
397 397
      /// This iterator goes trough the outgoing directed arcs of a node.
398 398

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

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

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

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

	
438 438
        /// Sets the iterator to the value of the trivial iterator.
439 439
	/// This feature necessitates that each time we 
440 440
        /// iterate the arc-set, the iteration order is the same.
441 441
        OutArcIt(const Graph&, const Arc&) { }
442 442
        ///Next outgoing arc
443 443
        
444 444
        /// Assign the iterator to the next 
445 445
        /// outgoing arc of the corresponding node.
446 446
        OutArcIt& operator++() { return *this; }
447 447
      };
448 448

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

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

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

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

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

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

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

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

	
501 501
      /// \brief Read write map of the nodes to type \c T.
502 502
      /// 
503 503
      /// ReadWrite map of the nodes to type \c T.
504 504
      /// \sa Reference
505 505
      template<class T> 
506 506
      class NodeMap : public ReadWriteMap< Node, T >
507 507
      {
508 508
      public:
509 509

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

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

	
525 525
      /// \brief Read write map of the directed arcs to type \c T.
526 526
      ///
527 527
      /// Reference map of the directed arcs to type \c T.
528 528
      /// \sa Reference
529 529
      template<class T> 
530 530
      class ArcMap : public ReadWriteMap<Arc,T>
531 531
      {
532 532
      public:
533 533

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

	
548 548
      /// Read write map of the edges to type \c T.
549 549

	
550 550
      /// Reference map of the arcs to type \c T.
551 551
      /// \sa Reference
552 552
      template<class T> 
553 553
      class EdgeMap : public ReadWriteMap<Edge,T>
554 554
      {
555 555
      public:
556 556

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

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

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

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

	
595 595
      /// \brief Returns the opposite directed arc.
596 596
      ///
597 597
      /// Returns the opposite directed arc.
598 598
      Arc oppositeArc(Arc) const { return INVALID; }
599 599

	
600 600
      /// \brief Opposite node on an arc
601 601
      ///
602 602
      /// \return the opposite of the given Node on the given Edge
603 603
      Node oppositeNode(Node, Edge) const { return INVALID; }
604 604

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

	
618 618
      /// \brief Second node of the edge.
619 619
      Node v(Edge) const { return INVALID; }
620 620

	
621 621
      /// \brief Source node of the directed arc.
622 622
      Node source(Arc) const { return INVALID; }
623 623

	
624 624
      /// \brief Target node of the directed arc.
625 625
      Node target(Arc) const { return INVALID; }
626 626

	
627 627
      /// \brief Returns the id of the node.
628 628
      int id(Node) const { return -1; } 
629 629

	
630 630
      /// \brief Returns the id of the edge.
631 631
      int id(Edge) const { return -1; } 
632 632

	
633 633
      /// \brief Returns the id of the arc.
634 634
      int id(Arc) const { return -1; } 
635 635

	
636 636
      /// \brief Returns the node with the given id.
637 637
      ///
638 638
      /// \pre The argument should be a valid node id in the graph.
639 639
      Node nodeFromId(int) const { return INVALID; } 
640 640

	
641 641
      /// \brief Returns the edge with the given id.
642 642
      ///
643 643
      /// \pre The argument should be a valid edge id in the graph.
644 644
      Edge edgeFromId(int) const { return INVALID; } 
645 645

	
646 646
      /// \brief Returns the arc with the given id.
647 647
      ///
648 648
      /// \pre The argument should be a valid arc id in the graph.
649 649
      Arc arcFromId(int) const { return INVALID; } 
650 650

	
651 651
      /// \brief Returns an upper bound on the node IDs.
652 652
      int maxNodeId() const { return -1; } 
653 653

	
654 654
      /// \brief Returns an upper bound on the edge IDs.
655 655
      int maxEdgeId() const { return -1; } 
656 656

	
657 657
      /// \brief Returns an upper bound on the arc IDs.
658 658
      int maxArcId() const { return -1; } 
659 659

	
660 660
      void first(Node&) const {}
661 661
      void next(Node&) const {}
662 662

	
663 663
      void first(Edge&) const {}
664 664
      void next(Edge&) const {}
665 665

	
666 666
      void first(Arc&) const {}
667 667
      void next(Arc&) const {}
668 668

	
669 669
      void firstOut(Arc&, Node) const {}
670 670
      void nextOut(Arc&) const {}
671 671

	
672 672
      void firstIn(Arc&, Node) const {}
673 673
      void nextIn(Arc&) const {}
674 674

	
675 675
      void firstInc(Edge &, bool &, const Node &) const {}
676 676
      void nextInc(Edge &, bool &) const {}
677 677

	
678 678
      // The second parameter is dummy.
679 679
      Node fromId(int, Node) const { return INVALID; }
680 680
      // The second parameter is dummy.
681 681
      Edge fromId(int, Edge) const { return INVALID; }
682 682
      // The second parameter is dummy.
683 683
      Arc fromId(int, Arc) const { return INVALID; }
684 684

	
685 685
      // Dummy parameter.
686 686
      int maxId(Node) const { return -1; } 
687 687
      // Dummy parameter.
688 688
      int maxId(Edge) const { return -1; } 
689 689
      // Dummy parameter.
690 690
      int maxId(Arc) const { return -1; } 
691 691

	
692 692
      /// \brief Base node of the iterator
693 693
      ///
694 694
      /// Returns the base node (the source in this case) of the iterator
695 695
      Node baseNode(OutArcIt e) const {
696 696
	return source(e);
697 697
      }
698 698
      /// \brief Running node of the iterator
699 699
      ///
700 700
      /// Returns the running node (the target in this case) of the
701 701
      /// iterator
702 702
      Node runningNode(OutArcIt e) const {
703 703
	return target(e);
704 704
      }
705 705

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

	
720 720
      /// \brief Base node of the iterator
721 721
      ///
722 722
      /// Returns the base node of the iterator
723
      Node baseNode(IncArcIt) const {
723
      Node baseNode(IncEdgeIt) const {
724 724
	return INVALID;
725 725
      }
726 726
      
727 727
      /// \brief Running node of the iterator
728 728
      ///
729 729
      /// Returns the running node of the iterator
730
      Node runningNode(IncArcIt) const {
730
      Node runningNode(IncEdgeIt) const {
731 731
	return INVALID;
732 732
      }
733 733

	
734 734
      template <typename Graph>
735 735
      struct Constraints {
736 736
	void constraints() {
737 737
	  checkConcept<IterableGraphComponent<>, Graph>();
738 738
	  checkConcept<IDableGraphComponent<>, Graph>();
739 739
	  checkConcept<MappableGraphComponent<>, Graph>();
740 740
	}
741 741
      };
742 742

	
743 743
    };
744 744

	
745 745
  }
746 746

	
747 747
}
748 748

	
749 749
#endif
Ignore white space 24576 line context
1 1
/* -*- C++ -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library
4 4
 *
5 5
 * Copyright (C) 2003-2007
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 graph components.
22 22

	
23 23

	
24 24
#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H
25 25
#define LEMON_CONCEPT_GRAPH_COMPONENTS_H
26 26

	
27 27
#include <lemon/bits/invalid.h>
28 28
#include <lemon/concepts/maps.h>
29 29

	
30 30
#include <lemon/bits/alteration_notifier.h>
31 31

	
32 32
namespace lemon {
33 33
  namespace concepts {
34 34

	
35 35
    /// \brief Skeleton class for graph Node and Arc types
36 36
    ///
37 37
    /// This class describes the interface of Node and Arc (and Edge
38 38
    /// in undirected graphs) subtypes of graph types.
39 39
    ///
40 40
    /// \note This class is a template class so that we can use it to
41 41
    /// create graph skeleton classes. The reason for this is than Node
42 42
    /// and Arc types should \em not derive from the same base class.
43 43
    /// For Node you should instantiate it with character 'n' and for Arc
44 44
    /// with 'a'.
45 45

	
46 46
#ifndef DOXYGEN
47 47
    template <char _selector = '0'>
48 48
#endif
49 49
    class GraphItem {
50 50
    public:
51 51
      /// \brief Default constructor.
52 52
      ///      
53 53
      /// \warning The default constructor is not required to set
54 54
      /// the item to some well-defined value. So you should consider it
55 55
      /// as uninitialized.
56 56
      GraphItem() {}
57 57
      /// \brief Copy constructor.
58 58
      ///
59 59
      /// Copy constructor.
60 60
      ///
61 61
      GraphItem(const GraphItem &) {}
62 62
      /// \brief Invalid constructor \& conversion.
63 63
      ///
64 64
      /// This constructor initializes the item to be invalid.
65 65
      /// \sa Invalid for more details.
66 66
      GraphItem(Invalid) {}
67 67
      /// \brief Assign operator for nodes.
68 68
      ///
69 69
      /// The nodes are assignable. 
70 70
      ///
71 71
      GraphItem& operator=(GraphItem const&) { return *this; }
72 72
      /// \brief Equality operator.
73 73
      ///
74 74
      /// Two iterators are equal if and only if they represents the
75 75
      /// same node in the graph or both are invalid.
76 76
      bool operator==(GraphItem) const { return false; }
77 77
      /// \brief Inequality operator.
78 78
      ///
79 79
      /// \sa operator==(const Node& n)
80 80
      ///
81 81
      bool operator!=(GraphItem) const { return false; }
82 82

	
83 83
      /// \brief Artificial ordering operator.
84 84
      ///
85 85
      /// To allow the use of graph descriptors as key type in std::map or
86 86
      /// similar associative container we require this.
87 87
      ///
88 88
      /// \note This operator only have to define some strict ordering of
89 89
      /// the items; this order has nothing to do with the iteration
90 90
      /// ordering of the items.
91 91
      bool operator<(GraphItem) const { return false; }
92 92

	
93 93
      template<typename _GraphItem>
94 94
      struct Constraints {
95 95
	void constraints() {
96 96
	  _GraphItem i1;
97 97
	  _GraphItem i2 = i1;
98 98
	  _GraphItem i3 = INVALID;
99 99
	  
100 100
	  i1 = i2 = i3;
101 101

	
102 102
	  bool b;
103 103
	  //	  b = (ia == ib) && (ia != ib) && (ia < ib);
104 104
	  b = (ia == ib) && (ia != ib);
105 105
	  b = (ia == INVALID) && (ib != INVALID);
106 106
          b = (ia < ib);
107 107
	}
108 108

	
109 109
	const _GraphItem &ia;
110 110
	const _GraphItem &ib;
111 111
      };
112 112
    };
113 113

	
114 114
    /// \brief An empty base directed graph class.
115 115
    ///  
116 116
    /// This class provides the minimal set of features needed for a
117 117
    /// directed graph structure. All digraph concepts have to be
118 118
    /// conform to this base directed graph. It just provides types
119 119
    /// for nodes and arcs and functions to get the source and the
120 120
    /// target of the arcs.
121 121
    class BaseDigraphComponent {
122 122
    public:
123 123

	
124 124
      typedef BaseDigraphComponent Digraph;
125 125
      
126 126
      /// \brief Node class of the digraph.
127 127
      ///
128 128
      /// This class represents the Nodes of the digraph. 
129 129
      ///
130 130
      typedef GraphItem<'n'> Node;
131 131

	
132 132
      /// \brief Arc class of the digraph.
133 133
      ///
134 134
      /// This class represents the Arcs of the digraph. 
135 135
      ///
136 136
      typedef GraphItem<'e'> Arc;
137 137

	
138 138
      /// \brief Gives back the target node of an arc.
139 139
      ///
140 140
      /// Gives back the target node of an arc.
141 141
      ///
142 142
      Node target(const Arc&) const { return INVALID;}
143 143

	
144 144
      /// \brief Gives back the source node of an arc.
145 145
      ///
146 146
      /// Gives back the source node of an arc.
147 147
      ///
148 148
      Node source(const Arc&) const { return INVALID;}
149 149

	
150 150
      /// \brief Gives back the opposite node on the given arc.
151 151
      ///
152 152
      /// Gives back the opposite node on the given arc.
153 153
      Node oppositeNode(const Node&, const Arc&) const {
154 154
        return INVALID;
155 155
      }
156 156

	
157 157
      template <typename _Digraph>
158 158
      struct Constraints {
159 159
	typedef typename _Digraph::Node Node;
160 160
	typedef typename _Digraph::Arc Arc;
161 161
      
162 162
	void constraints() {
163 163
	  checkConcept<GraphItem<'n'>, Node>();
164 164
	  checkConcept<GraphItem<'a'>, Arc>();
165 165
	  {
166 166
	    Node n;
167 167
	    Arc e(INVALID);
168 168
	    n = digraph.source(e);
169 169
	    n = digraph.target(e);
170 170
            n = digraph.oppositeNode(n, e);
171 171
	  }      
172 172
	}
173 173
      
174 174
	const _Digraph& digraph;
175 175
      };
176 176
    };
177 177

	
178 178
    /// \brief An empty base undirected graph class.
179 179
    ///  
180 180
    /// This class provides the minimal set of features needed for an
181 181
    /// undirected graph structure. All undirected graph concepts have
182 182
    /// to be conform to this base graph. It just provides types for
183 183
    /// nodes, arcs and edges and functions to get the
184 184
    /// source and the target of the arcs and edges,
185 185
    /// conversion from arcs to edges and function to get
186 186
    /// both direction of the edges.
187 187
    class BaseGraphComponent : public BaseDigraphComponent {
188 188
    public:
189 189
      typedef BaseDigraphComponent::Node Node;
190 190
      typedef BaseDigraphComponent::Arc Arc;
191 191
      /// \brief Undirected arc class of the graph.
192 192
      ///
193 193
      /// This class represents the edges of the graph.
194 194
      /// The undirected graphs can be used as a directed graph which
195 195
      /// for each arc contains the opposite arc too so the graph is
196 196
      /// bidirected. The edge represents two opposite
197 197
      /// directed arcs.
198 198
      class Edge : public GraphItem<'u'> {
199 199
      public:
200 200
        typedef GraphItem<'u'> Parent;
201 201
        /// \brief Default constructor.
202 202
        ///      
203 203
        /// \warning The default constructor is not required to set
204 204
        /// the item to some well-defined value. So you should consider it
205 205
        /// as uninitialized.
206 206
        Edge() {}
207 207
        /// \brief Copy constructor.
208 208
        ///
209 209
        /// Copy constructor.
210 210
        ///
211 211
        Edge(const Edge &) : Parent() {}
212 212
        /// \brief Invalid constructor \& conversion.
213 213
        ///
214 214
        /// This constructor initializes the item to be invalid.
215 215
        /// \sa Invalid for more details.
216 216
        Edge(Invalid) {}
217 217
        /// \brief Converter from arc to edge.
218 218
        ///
219 219
        /// Besides the core graph item functionality each arc should
220 220
        /// be convertible to the represented edge. 
221 221
        Edge(const Arc&) {}
222 222
        /// \brief Assign arc to edge.
223 223
        ///
224 224
        /// Besides the core graph item functionality each arc should
225 225
        /// be convertible to the represented edge. 
226 226
        Edge& operator=(const Arc&) { return *this; }
227 227
      };
228 228

	
229 229
      /// \brief Returns the direction of the arc.
230 230
      ///
231 231
      /// Returns the direction of the arc. Each arc represents an
232 232
      /// edge with a direction. It gives back the
233 233
      /// direction.
234 234
      bool direction(const Arc&) const { return true; }
235 235

	
236 236
      /// \brief Returns the directed arc.
237 237
      ///
238 238
      /// Returns the directed arc from its direction and the
239 239
      /// represented edge.
240 240
      Arc direct(const Edge&, bool) const { return INVALID;} 
241 241

	
242 242
      /// \brief Returns the directed arc.
243 243
      ///
244 244
      /// Returns the directed arc from its source and the
245 245
      /// represented edge.
246 246
      Arc direct(const Edge&, const Node&) const { return INVALID;} 
247 247

	
248 248
      /// \brief Returns the opposite arc.
249 249
      ///
250 250
      /// Returns the opposite arc. It is the arc representing the
251 251
      /// same edge and has opposite direction.
252 252
      Arc oppositeArc(const Arc&) const { return INVALID;}
253 253

	
254 254
      /// \brief Gives back one ending of an edge.
255 255
      ///
256 256
      /// Gives back one ending of an edge.
257 257
      Node u(const Edge&) const { return INVALID;}
258 258

	
259 259
      /// \brief Gives back the other ending of an edge.
260 260
      ///
261 261
      /// Gives back the other ending of an edge.
262 262
      Node v(const Edge&) const { return INVALID;}
263 263
      
264 264
      template <typename _Graph>
265 265
      struct Constraints {
266 266
	typedef typename _Graph::Node Node;
267 267
	typedef typename _Graph::Arc Arc;
268 268
	typedef typename _Graph::Edge Edge;
269 269
      
270 270
	void constraints() {
271 271
          checkConcept<BaseDigraphComponent, _Graph>();
272 272
	  checkConcept<GraphItem<'u'>, Edge>();
273 273
	  {
274 274
	    Node n;
275 275
	    Edge ue(INVALID);
276 276
            Arc e;
277 277
	    n = graph.u(ue);
278 278
	    n = graph.v(ue);
279 279
            e = graph.direct(ue, true);
280 280
            e = graph.direct(ue, n);
281 281
            e = graph.oppositeArc(e);
282 282
            ue = e;
283 283
            bool d = graph.direction(e);
284 284
            ignore_unused_variable_warning(d);
285 285
	  }      
286 286
	}
287 287
      
288 288
	const _Graph& graph;
289 289
      };
290 290

	
291 291
    };
292 292

	
293 293
    /// \brief An empty idable base digraph class.
294 294
    ///  
295 295
    /// This class provides beside the core digraph features
296 296
    /// core id functions for the digraph structure.
297 297
    /// The most of the base digraphs should be conform to this concept.
298 298
    /// The id's are unique and immutable.
299 299
    template <typename _Base = BaseDigraphComponent>
300 300
    class IDableDigraphComponent : public _Base {
301 301
    public:
302 302

	
303 303
      typedef _Base Base;
304 304
      typedef typename Base::Node Node;
305 305
      typedef typename Base::Arc Arc;
306 306

	
307 307
      /// \brief Gives back an unique integer id for the Node. 
308 308
      ///
309 309
      /// Gives back an unique integer id for the Node. 
310 310
      ///
311 311
      int id(const Node&) const { return -1;}
312 312

	
313 313
      /// \brief Gives back the node by the unique id.
314 314
      ///
315 315
      /// Gives back the node by the unique id.
316 316
      /// If the digraph does not contain node with the given id
317 317
      /// then the result of the function is undetermined. 
318 318
      Node nodeFromId(int) const { return INVALID;}
319 319

	
320 320
      /// \brief Gives back an unique integer id for the Arc. 
321 321
      ///
322 322
      /// Gives back an unique integer id for the Arc. 
323 323
      ///
324 324
      int id(const Arc&) const { return -1;}
325 325

	
326 326
      /// \brief Gives back the arc by the unique id.
327 327
      ///
328 328
      /// Gives back the arc by the unique id.
329 329
      /// If the digraph does not contain arc with the given id
330 330
      /// then the result of the function is undetermined. 
331 331
      Arc arcFromId(int) const { return INVALID;}
332 332

	
333 333
      /// \brief Gives back an integer greater or equal to the maximum
334 334
      /// Node id.
335 335
      ///
336 336
      /// Gives back an integer greater or equal to the maximum Node
337 337
      /// id.
338 338
      int maxNodeId() const { return -1;}
339 339

	
340 340
      /// \brief Gives back an integer greater or equal to the maximum
341 341
      /// Arc id.
342 342
      ///
343 343
      /// Gives back an integer greater or equal to the maximum Arc
344 344
      /// id.
345 345
      int maxArcId() const { return -1;}
346 346

	
347 347
      template <typename _Digraph>
348 348
      struct Constraints {
349 349

	
350 350
	void constraints() {
351 351
	  checkConcept<Base, _Digraph >();
352 352
	  typename _Digraph::Node node;
353 353
	  int nid = digraph.id(node);
354 354
	  nid = digraph.id(node);
355 355
	  node = digraph.nodeFromId(nid);
356 356
	  typename _Digraph::Arc arc;
357 357
	  int eid = digraph.id(arc);
358 358
	  eid = digraph.id(arc);
359 359
	  arc = digraph.arcFromId(eid);
360 360

	
361 361
	  nid = digraph.maxNodeId();
362 362
	  ignore_unused_variable_warning(nid);
363 363
	  eid = digraph.maxArcId();
364 364
	  ignore_unused_variable_warning(eid);
365 365
	}
366 366

	
367 367
	const _Digraph& digraph;
368 368
      };
369 369
    };
370 370

	
371 371
    /// \brief An empty idable base undirected graph class.
372 372
    ///  
373 373
    /// This class provides beside the core undirected graph features
374 374
    /// core id functions for the undirected graph structure.  The
375 375
    /// most of the base undirected graphs should be conform to this
376 376
    /// concept.  The id's are unique and immutable.
377 377
    template <typename _Base = BaseGraphComponent>
378 378
    class IDableGraphComponent : public IDableDigraphComponent<_Base> {
379 379
    public:
380 380

	
381 381
      typedef _Base Base;
382 382
      typedef typename Base::Edge Edge;
383 383

	
384 384
      using IDableDigraphComponent<_Base>::id;
385 385

	
386 386
      /// \brief Gives back an unique integer id for the Edge. 
387 387
      ///
388 388
      /// Gives back an unique integer id for the Edge. 
389 389
      ///
390 390
      int id(const Edge&) const { return -1;}
391 391

	
392 392
      /// \brief Gives back the edge by the unique id.
393 393
      ///
394 394
      /// Gives back the edge by the unique id.  If the
395 395
      /// graph does not contain arc with the given id then the
396 396
      /// result of the function is undetermined.
397 397
      Edge edgeFromId(int) const { return INVALID;}
398 398

	
399 399
      /// \brief Gives back an integer greater or equal to the maximum
400 400
      /// Edge id.
401 401
      ///
402 402
      /// Gives back an integer greater or equal to the maximum Edge
403 403
      /// id.
404 404
      int maxEdgeId() const { return -1;}
405 405

	
406 406
      template <typename _Graph>
407 407
      struct Constraints {
408 408

	
409 409
	void constraints() {
410 410
	  checkConcept<Base, _Graph >();
411 411
	  checkConcept<IDableDigraphComponent<Base>, _Graph >();
412 412
	  typename _Graph::Edge edge;
413 413
	  int ueid = graph.id(edge);
414 414
	  ueid = graph.id(edge);
415 415
	  edge = graph.edgeFromId(ueid);
416 416
	  ueid = graph.maxEdgeId();
417 417
	  ignore_unused_variable_warning(ueid);
418 418
	}
419 419

	
420 420
	const _Graph& graph;
421 421
      };
422 422
    };
423 423

	
424 424
    /// \brief Skeleton class for graph NodeIt and ArcIt
425 425
    ///
426 426
    /// Skeleton class for graph NodeIt and ArcIt.
427 427
    ///
428 428
    template <typename _Graph, typename _Item>
429 429
    class GraphItemIt : public _Item {
430 430
    public:
431 431
      /// \brief Default constructor.
432 432
      ///
433 433
      /// @warning The default constructor sets the iterator
434 434
      /// to an undefined value.
435 435
      GraphItemIt() {}
436 436
      /// \brief Copy constructor.
437 437
      ///
438 438
      /// Copy constructor.
439 439
      ///
440 440
      GraphItemIt(const GraphItemIt& ) {}
441 441
      /// \brief Sets the iterator to the first item.
442 442
      ///
443 443
      /// Sets the iterator to the first item of \c the graph.
444 444
      ///
445 445
      explicit GraphItemIt(const _Graph&) {}
446 446
      /// \brief Invalid constructor \& conversion.
447 447
      ///
448 448
      /// This constructor initializes the item to be invalid.
449 449
      /// \sa Invalid for more details.
450 450
      GraphItemIt(Invalid) {}
451 451
      /// \brief Assign operator for items.
452 452
      ///
453 453
      /// The items are assignable. 
454 454
      ///
455 455
      GraphItemIt& operator=(const GraphItemIt&) { return *this; }      
456 456
      /// \brief Next item.
457 457
      /// 
458 458
      /// Assign the iterator to the next item.
459 459
      ///
460 460
      GraphItemIt& operator++() { return *this; }
461 461
      /// \brief Equality operator
462 462
      /// 
463 463
      /// Two iterators are equal if and only if they point to the
464 464
      /// same object or both are invalid.
465 465
      bool operator==(const GraphItemIt&) const { return true;}
466 466
      /// \brief Inequality operator
467 467
      ///	
468 468
      /// \sa operator==(Node n)
469 469
      ///
470 470
      bool operator!=(const GraphItemIt&) const { return true;}
471 471
      
472 472
      template<typename _GraphItemIt>
473 473
      struct Constraints {
474 474
	void constraints() {
475 475
	  _GraphItemIt it1(g);	
476 476
	  _GraphItemIt it2;
477 477

	
478 478
	  it2 = ++it1;
479 479
	  ++it2 = it1;
480 480
	  ++(++it1);
481 481

	
482 482
	  _Item bi = it1;
483 483
	  bi = it2;
484 484
	}
485 485
	_Graph& g;
486 486
      };
487 487
    };
488 488

	
489 489
    /// \brief Skeleton class for graph InArcIt and OutArcIt
490 490
    ///
491 491
    /// \note Because InArcIt and OutArcIt may not inherit from the same
492 492
    /// base class, the _selector is a additional template parameter. For 
493 493
    /// InArcIt you should instantiate it with character 'i' and for 
494 494
    /// OutArcIt with 'o'.
495 495
    template <typename _Graph,
496 496
	      typename _Item = typename _Graph::Arc,
497 497
              typename _Base = typename _Graph::Node, 
498 498
	      char _selector = '0'>
499 499
    class GraphIncIt : public _Item {
500 500
    public:
501 501
      /// \brief Default constructor.
502 502
      ///
503 503
      /// @warning The default constructor sets the iterator
504 504
      /// to an undefined value.
505 505
      GraphIncIt() {}
506 506
      /// \brief Copy constructor.
507 507
      ///
508 508
      /// Copy constructor.
509 509
      ///
510 510
      GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
511 511
      /// \brief Sets the iterator to the first arc incoming into or outgoing 
512 512
      /// from the node.
513 513
      ///
514 514
      /// Sets the iterator to the first arc incoming into or outgoing 
515 515
      /// from the node.
516 516
      ///
517 517
      explicit GraphIncIt(const _Graph&, const _Base&) {}
518 518
      /// \brief Invalid constructor \& conversion.
519 519
      ///
520 520
      /// This constructor initializes the item to be invalid.
521 521
      /// \sa Invalid for more details.
522 522
      GraphIncIt(Invalid) {}
523 523
      /// \brief Assign operator for iterators.
524 524
      ///
525 525
      /// The iterators are assignable. 
526 526
      ///
527 527
      GraphIncIt& operator=(GraphIncIt const&) { return *this; }      
528 528
      /// \brief Next item.
529 529
      ///
530 530
      /// Assign the iterator to the next item.
531 531
      ///
532 532
      GraphIncIt& operator++() { return *this; }
533 533

	
534 534
      /// \brief Equality operator
535 535
      ///
536 536
      /// Two iterators are equal if and only if they point to the
537 537
      /// same object or both are invalid.
538 538
      bool operator==(const GraphIncIt&) const { return true;}
539 539

	
540 540
      /// \brief Inequality operator
541 541
      ///
542 542
      /// \sa operator==(Node n)
543 543
      ///
544 544
      bool operator!=(const GraphIncIt&) const { return true;}
545 545

	
546 546
      template <typename _GraphIncIt>
547 547
      struct Constraints {
548 548
	void constraints() {
549 549
	  checkConcept<GraphItem<_selector>, _GraphIncIt>();
550 550
	  _GraphIncIt it1(graph, node);
551 551
	  _GraphIncIt it2;
552 552

	
553 553
	  it2 = ++it1;
554 554
	  ++it2 = it1;
555 555
	  ++(++it1);
556 556
	  _Item e = it1;
557 557
	  e = it2;
558 558

	
559 559
	}
560 560

	
561 561
	_Item arc;
562 562
	_Base node;
563 563
	_Graph graph;
564 564
	_GraphIncIt it;
565 565
      };
566 566
    };
567 567

	
568 568

	
569 569
    /// \brief An empty iterable digraph class.
570 570
    ///
571 571
    /// This class provides beside the core digraph features
572 572
    /// iterator based iterable interface for the digraph structure.
573 573
    /// This concept is part of the Digraph concept.
574 574
    template <typename _Base = BaseDigraphComponent>
575 575
    class IterableDigraphComponent : public _Base {
576 576

	
577 577
    public:
578 578
    
579 579
      typedef _Base Base;
580 580
      typedef typename Base::Node Node;
581 581
      typedef typename Base::Arc Arc;
582 582

	
583 583
      typedef IterableDigraphComponent Digraph;
584 584

	
585 585
      /// \name Base iteration
586 586
      /// 
587 587
      /// This interface provides functions for iteration on digraph items
588 588
      ///
589 589
      /// @{  
590 590

	
591 591
      /// \brief Gives back the first node in the iterating order.
592 592
      ///      
593 593
      /// Gives back the first node in the iterating order.
594 594
      ///     
595 595
      void first(Node&) const {}
596 596

	
597 597
      /// \brief Gives back the next node in the iterating order.
598 598
      ///
599 599
      /// Gives back the next node in the iterating order.
600 600
      ///     
601 601
      void next(Node&) const {}
602 602

	
603 603
      /// \brief Gives back the first arc in the iterating order.
604 604
      ///
605 605
      /// Gives back the first arc in the iterating order.
606 606
      ///     
607 607
      void first(Arc&) const {}
608 608

	
609 609
      /// \brief Gives back the next arc in the iterating order.
610 610
      ///
611 611
      /// Gives back the next arc in the iterating order.
612 612
      ///     
613 613
      void next(Arc&) const {}
614 614

	
615 615

	
616 616
      /// \brief Gives back the first of the arcs point to the given
617 617
      /// node.
618 618
      ///
619 619
      /// Gives back the first of the arcs point to the given node.
620 620
      ///     
621 621
      void firstIn(Arc&, const Node&) const {}
622 622

	
623 623
      /// \brief Gives back the next of the arcs points to the given
624 624
      /// node.
625 625
      ///
626 626
      /// Gives back the next of the arcs points to the given node.
627 627
      ///
628 628
      void nextIn(Arc&) const {}
629 629

	
630 630
      /// \brief Gives back the first of the arcs start from the
631 631
      /// given node.
632 632
      ///      
633 633
      /// Gives back the first of the arcs start from the given node.
634 634
      ///     
635 635
      void firstOut(Arc&, const Node&) const {}
636 636

	
637 637
      /// \brief Gives back the next of the arcs start from the given
638 638
      /// node.
639 639
      ///
640 640
      /// Gives back the next of the arcs start from the given node.
641 641
      ///     
642 642
      void nextOut(Arc&) const {}
643 643

	
644 644
      /// @}
645 645

	
646 646
      /// \name Class based iteration
647 647
      /// 
648 648
      /// This interface provides functions for iteration on digraph items
649 649
      ///
650 650
      /// @{
651 651

	
652 652
      /// \brief This iterator goes through each node.
653 653
      ///
654 654
      /// This iterator goes through each node.
655 655
      ///
656 656
      typedef GraphItemIt<Digraph, Node> NodeIt;
657 657

	
658 658
      /// \brief This iterator goes through each node.
659 659
      ///
660 660
      /// This iterator goes through each node.
661 661
      ///
662 662
      typedef GraphItemIt<Digraph, Arc> ArcIt;
663 663

	
664 664
      /// \brief This iterator goes trough the incoming arcs of a node.
665 665
      ///
666 666
      /// This iterator goes trough the \e inccoming arcs of a certain node
667 667
      /// of a digraph.
668 668
      typedef GraphIncIt<Digraph, Arc, Node, 'i'> InArcIt;
669 669

	
670 670
      /// \brief This iterator goes trough the outgoing arcs of a node.
671 671
      ///
672 672
      /// This iterator goes trough the \e outgoing arcs of a certain node
673 673
      /// of a digraph.
674 674
      typedef GraphIncIt<Digraph, Arc, Node, 'o'> OutArcIt;
675 675

	
676 676
      /// \brief The base node of the iterator.
677 677
      ///
678 678
      /// Gives back the base node of the iterator.
679 679
      /// It is always the target of the pointed arc.
680 680
      Node baseNode(const InArcIt&) const { return INVALID; }
681 681

	
682 682
      /// \brief The running node of the iterator.
683 683
      ///
684 684
      /// Gives back the running node of the iterator.
685 685
      /// It is always the source of the pointed arc.
686 686
      Node runningNode(const InArcIt&) const { return INVALID; }
687 687

	
688 688
      /// \brief The base node of the iterator.
689 689
      ///
690 690
      /// Gives back the base node of the iterator.
691 691
      /// It is always the source of the pointed arc.
692 692
      Node baseNode(const OutArcIt&) const { return INVALID; }
693 693

	
694 694
      /// \brief The running node of the iterator.
695 695
      ///
696 696
      /// Gives back the running node of the iterator.
697 697
      /// It is always the target of the pointed arc.
698 698
      Node runningNode(const OutArcIt&) const { return INVALID; }
699 699

	
700 700
      /// @}
701 701

	
702 702
      template <typename _Digraph> 
703 703
      struct Constraints {
704 704
	void constraints() {
705 705
	  checkConcept<Base, _Digraph>();
706 706

	
707 707
          {
708 708
            typename _Digraph::Node node(INVALID);      
709 709
            typename _Digraph::Arc arc(INVALID);
710 710
            {
711 711
              digraph.first(node);
712 712
              digraph.next(node);
713 713
            }
714 714
            {
715 715
              digraph.first(arc);
716 716
              digraph.next(arc);
717 717
            }
718 718
            {
719 719
              digraph.firstIn(arc, node);
720 720
              digraph.nextIn(arc);
721 721
            }
722 722
            {
723 723
              digraph.firstOut(arc, node);
724 724
              digraph.nextOut(arc);
725 725
            }
726 726
          }           
727 727

	
728 728
          {
729 729
            checkConcept<GraphItemIt<_Digraph, typename _Digraph::Arc>,
730 730
              typename _Digraph::ArcIt >();
731 731
            checkConcept<GraphItemIt<_Digraph, typename _Digraph::Node>,
732 732
              typename _Digraph::NodeIt >();
733 733
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc, 
734 734
              typename _Digraph::Node, 'i'>, typename _Digraph::InArcIt>();
735 735
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc, 
736 736
              typename _Digraph::Node, 'o'>, typename _Digraph::OutArcIt>();
737 737

	
738 738
            typename _Digraph::Node n;
739 739
            typename _Digraph::InArcIt ieit(INVALID);
740 740
            typename _Digraph::OutArcIt oeit(INVALID);
741 741
            n = digraph.baseNode(ieit);
742 742
            n = digraph.runningNode(ieit);
743 743
            n = digraph.baseNode(oeit);
744 744
            n = digraph.runningNode(oeit);
745 745
            ignore_unused_variable_warning(n);
746 746
          }
747 747
        }
748 748
	
749 749
	const _Digraph& digraph;
750 750
	
751 751
      };
752 752
    };
753 753

	
754 754
    /// \brief An empty iterable undirected graph class.
755 755
    ///
756 756
    /// This class provides beside the core graph features iterator
757 757
    /// based iterable interface for the undirected graph structure.
758 758
    /// This concept is part of the Graph concept.
759 759
    template <typename _Base = BaseGraphComponent>
760 760
    class IterableGraphComponent : public IterableDigraphComponent<_Base> {
761 761
    public:
762 762

	
763 763
      typedef _Base Base;
764 764
      typedef typename Base::Node Node;
765 765
      typedef typename Base::Arc Arc;
766 766
      typedef typename Base::Edge Edge;
767 767

	
768 768
    
769 769
      typedef IterableGraphComponent Graph;
770 770

	
771 771
      /// \name Base iteration
772 772
      /// 
773 773
      /// This interface provides functions for iteration on graph items
774 774
      /// @{  
775 775

	
776 776
      using IterableDigraphComponent<_Base>::first;
777 777
      using IterableDigraphComponent<_Base>::next;
778 778

	
779 779
      /// \brief Gives back the first edge in the iterating
780 780
      /// order.
781 781
      ///
782 782
      /// Gives back the first edge in the iterating order.
783 783
      ///     
784 784
      void first(Edge&) const {}
785 785

	
786 786
      /// \brief Gives back the next edge in the iterating
787 787
      /// order.
788 788
      ///
789 789
      /// Gives back the next edge in the iterating order.
790 790
      ///     
791 791
      void next(Edge&) const {}
792 792

	
793 793

	
794 794
      /// \brief Gives back the first of the edges from the
795 795
      /// given node.
796 796
      ///
797 797
      /// Gives back the first of the edges from the given
798 798
      /// node. The bool parameter gives back that direction which
799 799
      /// gives a good direction of the edge so the source of the
800 800
      /// directed arc is the given node.
801 801
      void firstInc(Edge&, bool&, const Node&) const {}
802 802

	
803 803
      /// \brief Gives back the next of the edges from the
804 804
      /// given node.
805 805
      ///
806 806
      /// Gives back the next of the edges from the given
807 807
      /// node. The bool parameter should be used as the \c firstInc()
808 808
      /// use it.
809 809
      void nextInc(Edge&, bool&) const {}
810 810

	
811 811
      using IterableDigraphComponent<_Base>::baseNode;
812 812
      using IterableDigraphComponent<_Base>::runningNode;
813 813

	
814 814
      /// @}
815 815

	
816 816
      /// \name Class based iteration
817 817
      /// 
818 818
      /// This interface provides functions for iteration on graph items
819 819
      ///
820 820
      /// @{
821 821

	
822 822
      /// \brief This iterator goes through each node.
823 823
      ///
824 824
      /// This iterator goes through each node.
825 825
      typedef GraphItemIt<Graph, Edge> EdgeIt;
826 826
      /// \brief This iterator goes trough the incident arcs of a
827 827
      /// node.
828 828
      ///
829 829
      /// This iterator goes trough the incident arcs of a certain
830 830
      /// node of a graph.
831
      typedef GraphIncIt<Graph, Edge, Node, 'u'> IncArcIt;
831
      typedef GraphIncIt<Graph, Edge, Node, 'u'> IncEdgeIt;
832 832
      /// \brief The base node of the iterator.
833 833
      ///
834 834
      /// Gives back the base node of the iterator.
835
      Node baseNode(const IncArcIt&) const { return INVALID; }
835
      Node baseNode(const IncEdgeIt&) const { return INVALID; }
836 836

	
837 837
      /// \brief The running node of the iterator.
838 838
      ///
839 839
      /// Gives back the running node of the iterator.
840
      Node runningNode(const IncArcIt&) const { return INVALID; }
840
      Node runningNode(const IncEdgeIt&) const { return INVALID; }
841 841

	
842 842
      /// @}
843 843

	
844 844
      template <typename _Graph> 
845 845
      struct Constraints {
846 846
	void constraints() {
847 847
	  checkConcept<IterableDigraphComponent<Base>, _Graph>();
848 848

	
849 849
          {
850 850
            typename _Graph::Node node(INVALID);
851 851
            typename _Graph::Edge edge(INVALID);
852 852
            bool dir;
853 853
            {
854 854
              graph.first(edge);
855 855
              graph.next(edge);
856 856
            }
857 857
            {
858 858
              graph.firstInc(edge, dir, node);
859 859
              graph.nextInc(edge, dir);
860 860
            }
861 861
            
862 862
          }	
863 863
  
864 864
          {
865 865
            checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
866 866
              typename _Graph::EdgeIt >();
867 867
            checkConcept<GraphIncIt<_Graph, typename _Graph::Edge, 
868
              typename _Graph::Node, 'u'>, typename _Graph::IncArcIt>();
868
              typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
869 869
            
870 870
            typename _Graph::Node n;
871
            typename _Graph::IncArcIt ueit(INVALID);
871
            typename _Graph::IncEdgeIt ueit(INVALID);
872 872
            n = graph.baseNode(ueit);
873 873
            n = graph.runningNode(ueit);
874 874
          }
875 875
        }
876 876
	
877 877
	const _Graph& graph;
878 878
	
879 879
      };
880 880
    };
881 881

	
882 882
    /// \brief An empty alteration notifier digraph class.
883 883
    ///  
884 884
    /// This class provides beside the core digraph features alteration
885 885
    /// notifier interface for the digraph structure.  This implements
886 886
    /// an observer-notifier pattern for each digraph item. More
887 887
    /// obsevers can be registered into the notifier and whenever an
888 888
    /// alteration occured in the digraph all the observers will
889 889
    /// notified about it.
890 890
    template <typename _Base = BaseDigraphComponent>
891 891
    class AlterableDigraphComponent : public _Base {
892 892
    public:
893 893

	
894 894
      typedef _Base Base;
895 895
      typedef typename Base::Node Node;
896 896
      typedef typename Base::Arc Arc;
897 897

	
898 898

	
899 899
      /// The node observer registry.
900 900
      typedef AlterationNotifier<AlterableDigraphComponent, Node> 
901 901
      NodeNotifier;
902 902
      /// The arc observer registry.
903 903
      typedef AlterationNotifier<AlterableDigraphComponent, Arc> 
904 904
      ArcNotifier;
905 905
      
906 906
      /// \brief Gives back the node alteration notifier.
907 907
      ///
908 908
      /// Gives back the node alteration notifier.
909 909
      NodeNotifier& notifier(Node) const {
910 910
	return NodeNotifier();
911 911
      }
912 912
      
913 913
      /// \brief Gives back the arc alteration notifier.
914 914
      ///
915 915
      /// Gives back the arc alteration notifier.
916 916
      ArcNotifier& notifier(Arc) const {
917 917
	return ArcNotifier();
918 918
      }
919 919

	
920 920
      template <typename _Digraph> 
921 921
      struct Constraints {
922 922
	void constraints() {
923 923
	  checkConcept<Base, _Digraph>();
924 924
          typename _Digraph::NodeNotifier& nn 
925 925
            = digraph.notifier(typename _Digraph::Node());
926 926

	
927 927
          typename _Digraph::ArcNotifier& en 
928 928
            = digraph.notifier(typename _Digraph::Arc());
929 929
          
930 930
          ignore_unused_variable_warning(nn);
931 931
          ignore_unused_variable_warning(en);
932 932
	}
933 933
	
934 934
	const _Digraph& digraph;
935 935
	
936 936
      };
937 937
      
938 938
    };
939 939

	
940 940
    /// \brief An empty alteration notifier undirected graph class.
941 941
    ///  
942 942
    /// This class provides beside the core graph features alteration
943 943
    /// notifier interface for the graph structure.  This implements
944 944
    /// an observer-notifier pattern for each graph item. More
945 945
    /// obsevers can be registered into the notifier and whenever an
946 946
    /// alteration occured in the graph all the observers will
947 947
    /// notified about it.
948 948
    template <typename _Base = BaseGraphComponent>
949 949
    class AlterableGraphComponent : public AlterableDigraphComponent<_Base> {
950 950
    public:
951 951

	
952 952
      typedef _Base Base;
953 953
      typedef typename Base::Edge Edge;
954 954

	
955 955

	
956 956
      /// The arc observer registry.
957 957
      typedef AlterationNotifier<AlterableGraphComponent, Edge> 
958 958
      EdgeNotifier;
959 959
      
960 960
      /// \brief Gives back the arc alteration notifier.
961 961
      ///
962 962
      /// Gives back the arc alteration notifier.
963 963
      EdgeNotifier& notifier(Edge) const {
964 964
	return EdgeNotifier();
965 965
      }
966 966

	
967 967
      template <typename _Graph> 
968 968
      struct Constraints {
969 969
	void constraints() {
970 970
	  checkConcept<AlterableGraphComponent<Base>, _Graph>();
971 971
          typename _Graph::EdgeNotifier& uen 
972 972
            = graph.notifier(typename _Graph::Edge());
973 973
          ignore_unused_variable_warning(uen);
974 974
	}
975 975
	
976 976
	const _Graph& graph;
977 977
	
978 978
      };
979 979
      
980 980
    };
981 981

	
982 982
    /// \brief Class describing the concept of graph maps
983 983
    /// 
984 984
    /// This class describes the common interface of the graph maps
985 985
    /// (NodeMap, ArcMap), that is \ref maps-page "maps" which can be used to
986 986
    /// associate data to graph descriptors (nodes or arcs).
987 987
    template <typename _Graph, typename _Item, typename _Value>
988 988
    class GraphMap : public ReadWriteMap<_Item, _Value> {
989 989
    public:
990 990

	
991 991
      typedef ReadWriteMap<_Item, _Value> Parent;
992 992

	
993 993
      /// The graph type of the map.
994 994
      typedef _Graph Graph;
995 995
      /// The key type of the map.
996 996
      typedef _Item Key;
997 997
      /// The value type of the map.
998 998
      typedef _Value Value;
999 999

	
1000 1000
      /// \brief Construct a new map.
1001 1001
      ///
1002 1002
      /// Construct a new map for the graph.
1003 1003
      explicit GraphMap(const Graph&) {}
1004 1004
      /// \brief Construct a new map with default value.
1005 1005
      ///
1006 1006
      /// Construct a new map for the graph and initalise the values.
1007 1007
      GraphMap(const Graph&, const Value&) {}
1008 1008
      /// \brief Copy constructor.
1009 1009
      ///
1010 1010
      /// Copy Constructor.
1011 1011
      GraphMap(const GraphMap&) : Parent() {}
1012 1012
      
1013 1013
      /// \brief Assign operator.
1014 1014
      ///
1015 1015
      /// Assign operator. It does not mofify the underlying graph,
1016 1016
      /// it just iterates on the current item set and set the  map
1017 1017
      /// with the value returned by the assigned map. 
1018 1018
      template <typename CMap>
1019 1019
      GraphMap& operator=(const CMap&) { 
1020 1020
        checkConcept<ReadMap<Key, Value>, CMap>();
1021 1021
        return *this;
1022 1022
      }
1023 1023

	
1024 1024
      template<typename _Map>
1025 1025
      struct Constraints {
1026 1026
	void constraints() {
1027 1027
	  checkConcept<ReadWriteMap<Key, Value>, _Map >();
1028 1028
	  // Construction with a graph parameter
1029 1029
	  _Map a(g);
1030 1030
	  // Constructor with a graph and a default value parameter
1031 1031
	  _Map a2(g,t);
1032 1032
	  // Copy constructor.
1033 1033
	  _Map b(c);
1034 1034
          
1035 1035
          ReadMap<Key, Value> cmap;
1036 1036
          b = cmap;
1037 1037

	
1038 1038
	  ignore_unused_variable_warning(a2);
1039 1039
	  ignore_unused_variable_warning(b);
1040 1040
	}
1041 1041

	
1042 1042
	const _Map &c;
1043 1043
	const Graph &g;
1044 1044
	const typename GraphMap::Value &t;
1045 1045
      };
1046 1046

	
1047 1047
    };
1048 1048

	
1049 1049
    /// \brief An empty mappable digraph class.
1050 1050
    ///
1051 1051
    /// This class provides beside the core digraph features
1052 1052
    /// map interface for the digraph structure.
1053 1053
    /// This concept is part of the Digraph concept.
1054 1054
    template <typename _Base = BaseDigraphComponent>
1055 1055
    class MappableDigraphComponent : public _Base  {
1056 1056
    public:
1057 1057

	
1058 1058
      typedef _Base Base;
1059 1059
      typedef typename Base::Node Node;
1060 1060
      typedef typename Base::Arc Arc;
1061 1061

	
1062 1062
      typedef MappableDigraphComponent Digraph;
1063 1063

	
1064 1064
      /// \brief ReadWrite map of the nodes.
1065 1065
      ///
1066 1066
      /// ReadWrite map of the nodes.
1067 1067
      ///
1068 1068
      template <typename _Value>
1069 1069
      class NodeMap : public GraphMap<Digraph, Node, _Value> {
1070 1070
      public:
1071 1071
        typedef GraphMap<MappableDigraphComponent, Node, _Value> Parent;
1072 1072

	
1073 1073
	/// \brief Construct a new map.
1074 1074
	///
1075 1075
	/// Construct a new map for the digraph.
1076 1076
	explicit NodeMap(const MappableDigraphComponent& digraph) 
1077 1077
          : Parent(digraph) {}
1078 1078

	
1079 1079
	/// \brief Construct a new map with default value.
1080 1080
	///
1081 1081
	/// Construct a new map for the digraph and initalise the values.
1082 1082
	NodeMap(const MappableDigraphComponent& digraph, const _Value& value)
1083 1083
          : Parent(digraph, value) {}
1084 1084

	
1085 1085
	/// \brief Copy constructor.
1086 1086
	///
1087 1087
	/// Copy Constructor.
1088 1088
	NodeMap(const NodeMap& nm) : Parent(nm) {}
1089 1089

	
1090 1090
	/// \brief Assign operator.
1091 1091
	///
1092 1092
	/// Assign operator.
1093 1093
        template <typename CMap>
1094 1094
        NodeMap& operator=(const CMap&) { 
1095 1095
          checkConcept<ReadMap<Node, _Value>, CMap>();
1096 1096
          return *this;
1097 1097
        }
1098 1098

	
1099 1099
      };
1100 1100

	
1101 1101
      /// \brief ReadWrite map of the arcs.
1102 1102
      ///
1103 1103
      /// ReadWrite map of the arcs.
1104 1104
      ///
1105 1105
      template <typename _Value>
1106 1106
      class ArcMap : public GraphMap<Digraph, Arc, _Value> {
1107 1107
      public:
1108 1108
        typedef GraphMap<MappableDigraphComponent, Arc, _Value> Parent;
1109 1109

	
1110 1110
	/// \brief Construct a new map.
1111 1111
	///
1112 1112
	/// Construct a new map for the digraph.
1113 1113
	explicit ArcMap(const MappableDigraphComponent& digraph) 
1114 1114
          : Parent(digraph) {}
1115 1115

	
1116 1116
	/// \brief Construct a new map with default value.
1117 1117
	///
1118 1118
	/// Construct a new map for the digraph and initalise the values.
1119 1119
	ArcMap(const MappableDigraphComponent& digraph, const _Value& value)
1120 1120
          : Parent(digraph, value) {}
1121 1121

	
1122 1122
	/// \brief Copy constructor.
1123 1123
	///
1124 1124
	/// Copy Constructor.
1125 1125
	ArcMap(const ArcMap& nm) : Parent(nm) {}
1126 1126

	
1127 1127
	/// \brief Assign operator.
1128 1128
	///
1129 1129
	/// Assign operator.
1130 1130
        template <typename CMap>
1131 1131
        ArcMap& operator=(const CMap&) { 
1132 1132
          checkConcept<ReadMap<Arc, _Value>, CMap>();
1133 1133
          return *this;
1134 1134
        }
1135 1135

	
1136 1136
      };
1137 1137

	
1138 1138

	
1139 1139
      template <typename _Digraph>
1140 1140
      struct Constraints {
1141 1141

	
1142 1142
	struct Dummy {
1143 1143
	  int value;
1144 1144
	  Dummy() : value(0) {}
1145 1145
	  Dummy(int _v) : value(_v) {}
1146 1146
	};
1147 1147

	
1148 1148
	void constraints() {
1149 1149
	  checkConcept<Base, _Digraph>();
1150 1150
	  { // int map test
1151 1151
	    typedef typename _Digraph::template NodeMap<int> IntNodeMap;
1152 1152
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Node, int>, 
1153 1153
	      IntNodeMap >();
1154 1154
	  } { // bool map test
1155 1155
	    typedef typename _Digraph::template NodeMap<bool> BoolNodeMap;
1156 1156
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Node, bool>,
1157 1157
	      BoolNodeMap >();
1158 1158
	  } { // Dummy map test
1159 1159
	    typedef typename _Digraph::template NodeMap<Dummy> DummyNodeMap;
1160 1160
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Node, Dummy>,
1161 1161
	      DummyNodeMap >();
1162 1162
	  } 
1163 1163

	
1164 1164
	  { // int map test
1165 1165
	    typedef typename _Digraph::template ArcMap<int> IntArcMap;
1166 1166
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, int>,
1167 1167
	      IntArcMap >();
1168 1168
	  } { // bool map test
1169 1169
	    typedef typename _Digraph::template ArcMap<bool> BoolArcMap;
1170 1170
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, bool>,
1171 1171
	      BoolArcMap >();
1172 1172
	  } { // Dummy map test
1173 1173
	    typedef typename _Digraph::template ArcMap<Dummy> DummyArcMap;
1174 1174
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, Dummy>, 
1175 1175
	      DummyArcMap >();
1176 1176
	  } 
1177 1177
	}
1178 1178

	
1179 1179
	_Digraph& digraph;
1180 1180
      };
1181 1181
    };
1182 1182

	
1183 1183
    /// \brief An empty mappable base bipartite graph class.
1184 1184
    ///
1185 1185
    /// This class provides beside the core graph features
1186 1186
    /// map interface for the graph structure.
1187 1187
    /// This concept is part of the Graph concept.
1188 1188
    template <typename _Base = BaseGraphComponent>
1189 1189
    class MappableGraphComponent : public MappableDigraphComponent<_Base>  {
1190 1190
    public:
1191 1191

	
1192 1192
      typedef _Base Base;
1193 1193
      typedef typename Base::Edge Edge;
1194 1194

	
1195 1195
      typedef MappableGraphComponent Graph;
1196 1196

	
1197 1197
      /// \brief ReadWrite map of the edges.
1198 1198
      ///
1199 1199
      /// ReadWrite map of the edges.
1200 1200
      ///
1201 1201
      template <typename _Value>
1202 1202
      class EdgeMap : public GraphMap<Graph, Edge, _Value> {  
1203 1203
      public:
1204 1204
        typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
1205 1205

	
1206 1206
	/// \brief Construct a new map.
1207 1207
	///
1208 1208
	/// Construct a new map for the graph.
1209 1209
	explicit EdgeMap(const MappableGraphComponent& graph) 
1210 1210
          : Parent(graph) {}
1211 1211

	
1212 1212
	/// \brief Construct a new map with default value.
1213 1213
	///
1214 1214
	/// Construct a new map for the graph and initalise the values.
1215 1215
	EdgeMap(const MappableGraphComponent& graph, const _Value& value)
1216 1216
          : Parent(graph, value) {}
1217 1217

	
1218 1218
	/// \brief Copy constructor.
1219 1219
	///
1220 1220
	/// Copy Constructor.
1221 1221
	EdgeMap(const EdgeMap& nm) : Parent(nm) {}
1222 1222

	
1223 1223
	/// \brief Assign operator.
1224 1224
	///
1225 1225
	/// Assign operator.
1226 1226
        template <typename CMap>
1227 1227
        EdgeMap& operator=(const CMap&) { 
1228 1228
          checkConcept<ReadMap<Edge, _Value>, CMap>();
1229 1229
          return *this;
1230 1230
        }
1231 1231

	
1232 1232
      };
1233 1233

	
1234 1234

	
1235 1235
      template <typename _Graph>
1236 1236
      struct Constraints {
1237 1237

	
1238 1238
	struct Dummy {
1239 1239
	  int value;
1240 1240
	  Dummy() : value(0) {}
1241 1241
	  Dummy(int _v) : value(_v) {}
1242 1242
	};
1243 1243

	
1244 1244
	void constraints() {
1245 1245
	  checkConcept<MappableGraphComponent<Base>, _Graph>();
1246 1246

	
1247 1247
	  { // int map test
1248 1248
	    typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
1249 1249
	    checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
1250 1250
	      IntEdgeMap >();
1251 1251
	  } { // bool map test
1252 1252
	    typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
1253 1253
	    checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
1254 1254
	      BoolEdgeMap >();
1255 1255
	  } { // Dummy map test
1256 1256
	    typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
1257 1257
	    checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>, 
1258 1258
	      DummyEdgeMap >();
1259 1259
	  } 
1260 1260
	}
1261 1261

	
1262 1262
	_Graph& graph;
1263 1263
      };
1264 1264
    };
1265 1265

	
1266 1266
    /// \brief An empty extendable digraph class.
1267 1267
    ///
1268 1268
    /// This class provides beside the core digraph features digraph
1269 1269
    /// extendable interface for the digraph structure.  The main
1270 1270
    /// difference between the base and this interface is that the
1271 1271
    /// digraph alterations should handled already on this level.
1272 1272
    template <typename _Base = BaseDigraphComponent>
1273 1273
    class ExtendableDigraphComponent : public _Base {
1274 1274
    public:
1275 1275
      typedef _Base Base;
1276 1276

	
1277 1277
      typedef typename _Base::Node Node;
1278 1278
      typedef typename _Base::Arc Arc;
1279 1279

	
1280 1280
      /// \brief Adds a new node to the digraph.
1281 1281
      ///
1282 1282
      /// Adds a new node to the digraph.
1283 1283
      ///
1284 1284
      Node addNode() {
1285 1285
	return INVALID;
1286 1286
      }
1287 1287
    
1288 1288
      /// \brief Adds a new arc connects the given two nodes.
1289 1289
      ///
1290 1290
      /// Adds a new arc connects the the given two nodes.
1291 1291
      Arc addArc(const Node&, const Node&) {
1292 1292
	return INVALID;
1293 1293
      }
1294 1294

	
1295 1295
      template <typename _Digraph>
1296 1296
      struct Constraints {
1297 1297
	void constraints() {
1298 1298
          checkConcept<Base, _Digraph>();
1299 1299
	  typename _Digraph::Node node_a, node_b;
1300 1300
	  node_a = digraph.addNode();
1301 1301
	  node_b = digraph.addNode();
1302 1302
	  typename _Digraph::Arc arc;
1303 1303
	  arc = digraph.addArc(node_a, node_b);
1304 1304
	}
1305 1305

	
1306 1306
	_Digraph& digraph;
1307 1307
      };
1308 1308
    };
1309 1309

	
1310 1310
    /// \brief An empty extendable base undirected graph class.
1311 1311
    ///
1312 1312
    /// This class provides beside the core undirected graph features
1313 1313
    /// core undircted graph extend interface for the graph structure.
1314 1314
    /// The main difference between the base and this interface is
1315 1315
    /// that the graph alterations should handled already on this
1316 1316
    /// level.
1317 1317
    template <typename _Base = BaseGraphComponent>
1318 1318
    class ExtendableGraphComponent : public _Base {
1319 1319
    public:
1320 1320

	
1321 1321
      typedef _Base Base;
1322 1322
      typedef typename _Base::Node Node;
1323 1323
      typedef typename _Base::Edge Edge;
1324 1324

	
1325 1325
      /// \brief Adds a new node to the graph.
1326 1326
      ///
1327 1327
      /// Adds a new node to the graph.
1328 1328
      ///
1329 1329
      Node addNode() {
1330 1330
	return INVALID;
1331 1331
      }
1332 1332
    
1333 1333
      /// \brief Adds a new arc connects the given two nodes.
1334 1334
      ///
1335 1335
      /// Adds a new arc connects the the given two nodes.
1336 1336
      Edge addArc(const Node&, const Node&) {
1337 1337
	return INVALID;
1338 1338
      }
1339 1339

	
1340 1340
      template <typename _Graph>
1341 1341
      struct Constraints {
1342 1342
	void constraints() {
1343 1343
	  checkConcept<Base, _Graph>();
1344 1344
	  typename _Graph::Node node_a, node_b;
1345 1345
	  node_a = graph.addNode();
1346 1346
	  node_b = graph.addNode();
1347 1347
	  typename _Graph::Edge edge;
1348 1348
	  edge = graph.addEdge(node_a, node_b);
1349 1349
	}
1350 1350

	
1351 1351
	_Graph& graph;
1352 1352
      };
1353 1353
    };
1354 1354

	
1355 1355
    /// \brief An empty erasable digraph class.
1356 1356
    ///  
1357 1357
    /// This class provides beside the core digraph features core erase
1358 1358
    /// functions for the digraph structure. The main difference between
1359 1359
    /// the base and this interface is that the digraph alterations
1360 1360
    /// should handled already on this level.
1361 1361
    template <typename _Base = BaseDigraphComponent>
1362 1362
    class ErasableDigraphComponent : public _Base {
1363 1363
    public:
1364 1364

	
1365 1365
      typedef _Base Base;
1366 1366
      typedef typename Base::Node Node;
1367 1367
      typedef typename Base::Arc Arc;
1368 1368

	
1369 1369
      /// \brief Erase a node from the digraph.
1370 1370
      ///
1371 1371
      /// Erase a node from the digraph. This function should 
1372 1372
      /// erase all arcs connecting to the node.
1373 1373
      void erase(const Node&) {}    
1374 1374

	
1375 1375
      /// \brief Erase an arc from the digraph.
1376 1376
      ///
1377 1377
      /// Erase an arc from the digraph.
1378 1378
      ///
1379 1379
      void erase(const Arc&) {}
1380 1380

	
1381 1381
      template <typename _Digraph>
1382 1382
      struct Constraints {
1383 1383
	void constraints() {
1384 1384
          checkConcept<Base, _Digraph>();
1385 1385
	  typename _Digraph::Node node;
1386 1386
	  digraph.erase(node);
1387 1387
	  typename _Digraph::Arc arc;
1388 1388
	  digraph.erase(arc);
1389 1389
	}
1390 1390

	
1391 1391
	_Digraph& digraph;
1392 1392
      };
1393 1393
    };
1394 1394

	
1395 1395
    /// \brief An empty erasable base undirected graph class.
1396 1396
    ///  
1397 1397
    /// This class provides beside the core undirected graph features
1398 1398
    /// core erase functions for the undirceted graph structure. The
1399 1399
    /// main difference between the base and this interface is that
1400 1400
    /// the graph alterations should handled already on this level.
1401 1401
    template <typename _Base = BaseGraphComponent>
1402 1402
    class ErasableGraphComponent : public _Base {
1403 1403
    public:
1404 1404

	
1405 1405
      typedef _Base Base;
1406 1406
      typedef typename Base::Node Node;
1407 1407
      typedef typename Base::Edge Edge;
1408 1408

	
1409 1409
      /// \brief Erase a node from the graph.
1410 1410
      ///
1411 1411
      /// Erase a node from the graph. This function should erase
1412 1412
      /// arcs connecting to the node.
1413 1413
      void erase(const Node&) {}    
1414 1414

	
1415 1415
      /// \brief Erase an arc from the graph.
1416 1416
      ///
1417 1417
      /// Erase an arc from the graph.
1418 1418
      ///
1419 1419
      void erase(const Edge&) {}
1420 1420

	
1421 1421
      template <typename _Graph>
1422 1422
      struct Constraints {
1423 1423
	void constraints() {
1424 1424
          checkConcept<Base, _Graph>();
1425 1425
	  typename _Graph::Node node;
1426 1426
	  graph.erase(node);
1427 1427
	  typename _Graph::Arc arc;
1428 1428
	  graph.erase(arc);
1429 1429
	}
1430 1430

	
1431 1431
	_Graph& graph;
1432 1432
      };
1433 1433
    };
1434 1434

	
1435 1435
    /// \brief An empty clearable base digraph class.
1436 1436
    ///
1437 1437
    /// This class provides beside the core digraph features core clear
1438 1438
    /// functions for the digraph structure. The main difference between
1439 1439
    /// the base and this interface is that the digraph alterations
1440 1440
    /// should handled already on this level.
1441 1441
    template <typename _Base = BaseDigraphComponent>
1442 1442
    class ClearableDigraphComponent : public _Base {
1443 1443
    public:
1444 1444

	
1445 1445
      typedef _Base Base;
1446 1446

	
1447 1447
      /// \brief Erase all nodes and arcs from the digraph.
1448 1448
      ///
1449 1449
      /// Erase all nodes and arcs from the digraph.
1450 1450
      ///
1451 1451
      void clear() {}    
1452 1452

	
1453 1453
      template <typename _Digraph>
1454 1454
      struct Constraints {
1455 1455
	void constraints() {
1456 1456
          checkConcept<Base, _Digraph>();
1457 1457
	  digraph.clear();
1458 1458
	}
1459 1459

	
1460 1460
	_Digraph digraph;
1461 1461
      };
1462 1462
    };
1463 1463

	
1464 1464
    /// \brief An empty clearable base undirected graph class.
1465 1465
    ///
1466 1466
    /// This class provides beside the core undirected graph features
1467 1467
    /// core clear functions for the undirected graph structure. The
1468 1468
    /// main difference between the base and this interface is that
1469 1469
    /// the graph alterations should handled already on this level.
1470 1470
    template <typename _Base = BaseGraphComponent>
1471 1471
    class ClearableGraphComponent : public ClearableDigraphComponent<_Base> {
1472 1472
    public:
1473 1473

	
1474 1474
      typedef _Base Base;
1475 1475

	
1476 1476
      template <typename _Graph>
1477 1477
      struct Constraints {
1478 1478
	void constraints() {
1479 1479
          checkConcept<ClearableGraphComponent<Base>, _Graph>();
1480 1480
	}
1481 1481

	
1482 1482
	_Graph graph;
1483 1483
      };
1484 1484
    };
1485 1485

	
1486 1486
  }
1487 1487

	
1488 1488
}
1489 1489

	
1490 1490
#endif
0 comments (0 inline)