348 return edge_notifier; |
347 return edge_notifier; |
349 } |
348 } |
350 |
349 |
351 |
350 |
352 class NodeIt : public Node { |
351 class NodeIt : public Node { |
353 const Digraph* digraph; |
352 const Graph* graph; |
354 public: |
353 public: |
355 |
354 |
356 NodeIt() {} |
355 NodeIt() {} |
357 |
356 |
358 NodeIt(Invalid i) : Node(i) { } |
357 NodeIt(Invalid i) : Node(i) { } |
359 |
358 |
360 explicit NodeIt(const Digraph& _graph) : digraph(&_graph) { |
359 explicit NodeIt(const Graph& _graph) : graph(&_graph) { |
361 _graph.first(static_cast<Node&>(*this)); |
360 _graph.first(static_cast<Node&>(*this)); |
362 } |
361 } |
363 |
362 |
364 NodeIt(const Digraph& _graph, const Node& node) |
363 NodeIt(const Graph& _graph, const Node& node) |
365 : Node(node), digraph(&_graph) {} |
364 : Node(node), graph(&_graph) {} |
366 |
365 |
367 NodeIt& operator++() { |
366 NodeIt& operator++() { |
368 digraph->next(*this); |
367 graph->next(*this); |
369 return *this; |
368 return *this; |
370 } |
369 } |
371 |
370 |
372 }; |
371 }; |
373 |
372 |
374 |
373 |
375 class ArcIt : public Arc { |
374 class ArcIt : public Arc { |
376 const Digraph* digraph; |
375 const Graph* graph; |
377 public: |
376 public: |
378 |
377 |
379 ArcIt() { } |
378 ArcIt() { } |
380 |
379 |
381 ArcIt(Invalid i) : Arc(i) { } |
380 ArcIt(Invalid i) : Arc(i) { } |
382 |
381 |
383 explicit ArcIt(const Digraph& _graph) : digraph(&_graph) { |
382 explicit ArcIt(const Graph& _graph) : graph(&_graph) { |
384 _graph.first(static_cast<Arc&>(*this)); |
383 _graph.first(static_cast<Arc&>(*this)); |
385 } |
384 } |
386 |
385 |
387 ArcIt(const Digraph& _graph, const Arc& e) : |
386 ArcIt(const Graph& _graph, const Arc& e) : |
388 Arc(e), digraph(&_graph) { } |
387 Arc(e), graph(&_graph) { } |
389 |
388 |
390 ArcIt& operator++() { |
389 ArcIt& operator++() { |
391 digraph->next(*this); |
390 graph->next(*this); |
392 return *this; |
391 return *this; |
393 } |
392 } |
394 |
393 |
395 }; |
394 }; |
396 |
395 |
397 |
396 |
398 class OutArcIt : public Arc { |
397 class OutArcIt : public Arc { |
399 const Digraph* digraph; |
398 const Graph* graph; |
400 public: |
399 public: |
401 |
400 |
402 OutArcIt() { } |
401 OutArcIt() { } |
403 |
402 |
404 OutArcIt(Invalid i) : Arc(i) { } |
403 OutArcIt(Invalid i) : Arc(i) { } |
405 |
404 |
406 OutArcIt(const Digraph& _graph, const Node& node) |
405 OutArcIt(const Graph& _graph, const Node& node) |
407 : digraph(&_graph) { |
406 : graph(&_graph) { |
408 _graph.firstOut(*this, node); |
407 _graph.firstOut(*this, node); |
409 } |
408 } |
410 |
409 |
411 OutArcIt(const Digraph& _graph, const Arc& arc) |
410 OutArcIt(const Graph& _graph, const Arc& arc) |
412 : Arc(arc), digraph(&_graph) {} |
411 : Arc(arc), graph(&_graph) {} |
413 |
412 |
414 OutArcIt& operator++() { |
413 OutArcIt& operator++() { |
415 digraph->nextOut(*this); |
414 graph->nextOut(*this); |
416 return *this; |
415 return *this; |
417 } |
416 } |
418 |
417 |
419 }; |
418 }; |
420 |
419 |
421 |
420 |
422 class InArcIt : public Arc { |
421 class InArcIt : public Arc { |
423 const Digraph* digraph; |
422 const Graph* graph; |
424 public: |
423 public: |
425 |
424 |
426 InArcIt() { } |
425 InArcIt() { } |
427 |
426 |
428 InArcIt(Invalid i) : Arc(i) { } |
427 InArcIt(Invalid i) : Arc(i) { } |
429 |
428 |
430 InArcIt(const Digraph& _graph, const Node& node) |
429 InArcIt(const Graph& _graph, const Node& node) |
431 : digraph(&_graph) { |
430 : graph(&_graph) { |
432 _graph.firstIn(*this, node); |
431 _graph.firstIn(*this, node); |
433 } |
432 } |
434 |
433 |
435 InArcIt(const Digraph& _graph, const Arc& arc) : |
434 InArcIt(const Graph& _graph, const Arc& arc) : |
436 Arc(arc), digraph(&_graph) {} |
435 Arc(arc), graph(&_graph) {} |
437 |
436 |
438 InArcIt& operator++() { |
437 InArcIt& operator++() { |
439 digraph->nextIn(*this); |
438 graph->nextIn(*this); |
440 return *this; |
439 return *this; |
441 } |
440 } |
442 |
441 |
443 }; |
442 }; |
444 |
443 |
445 |
444 |
446 class EdgeIt : public Parent::Edge { |
445 class EdgeIt : public Parent::Edge { |
447 const Digraph* digraph; |
446 const Graph* graph; |
448 public: |
447 public: |
449 |
448 |
450 EdgeIt() { } |
449 EdgeIt() { } |
451 |
450 |
452 EdgeIt(Invalid i) : Edge(i) { } |
451 EdgeIt(Invalid i) : Edge(i) { } |
453 |
452 |
454 explicit EdgeIt(const Digraph& _graph) : digraph(&_graph) { |
453 explicit EdgeIt(const Graph& _graph) : graph(&_graph) { |
455 _graph.first(static_cast<Edge&>(*this)); |
454 _graph.first(static_cast<Edge&>(*this)); |
456 } |
455 } |
457 |
456 |
458 EdgeIt(const Digraph& _graph, const Edge& e) : |
457 EdgeIt(const Graph& _graph, const Edge& e) : |
459 Edge(e), digraph(&_graph) { } |
458 Edge(e), graph(&_graph) { } |
460 |
459 |
461 EdgeIt& operator++() { |
460 EdgeIt& operator++() { |
462 digraph->next(*this); |
461 graph->next(*this); |
463 return *this; |
462 return *this; |
464 } |
463 } |
465 |
464 |
466 }; |
465 }; |
467 |
466 |
468 class IncEdgeIt : public Parent::Edge { |
467 class IncEdgeIt : public Parent::Edge { |
469 friend class EdgeSetExtender; |
468 friend class EdgeSetExtender; |
470 const Digraph* digraph; |
469 const Graph* graph; |
471 bool direction; |
470 bool direction; |
472 public: |
471 public: |
473 |
472 |
474 IncEdgeIt() { } |
473 IncEdgeIt() { } |
475 |
474 |
476 IncEdgeIt(Invalid i) : Edge(i), direction(false) { } |
475 IncEdgeIt(Invalid i) : Edge(i), direction(false) { } |
477 |
476 |
478 IncEdgeIt(const Digraph& _graph, const Node &n) : digraph(&_graph) { |
477 IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { |
479 _graph.firstInc(*this, direction, n); |
478 _graph.firstInc(*this, direction, n); |
480 } |
479 } |
481 |
480 |
482 IncEdgeIt(const Digraph& _graph, const Edge &ue, const Node &n) |
481 IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n) |
483 : digraph(&_graph), Edge(ue) { |
482 : graph(&_graph), Edge(ue) { |
484 direction = (_graph.source(ue) == n); |
483 direction = (_graph.source(ue) == n); |
485 } |
484 } |
486 |
485 |
487 IncEdgeIt& operator++() { |
486 IncEdgeIt& operator++() { |
488 digraph->nextInc(*this, direction); |
487 graph->nextInc(*this, direction); |
489 return *this; |
488 return *this; |
490 } |
489 } |
491 }; |
490 }; |
492 |
491 |
493 // \brief Base node of the iterator |
492 // \brief Base node of the iterator |