... |
... |
@@ -66,7 +66,7 @@
|
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
|
... |
... |
@@ -97,3 +97,3 @@
|
97 |
97 |
class NodeIt : public Node {
|
98 |
|
const Digraph* digraph;
|
|
98 |
const Digraph* _digraph;
|
99 |
99 |
public:
|
... |
... |
@@ -104,11 +104,11 @@
|
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;
|
... |
... |
@@ -120,3 +120,3 @@
|
120 |
120 |
class ArcIt : public Arc {
|
121 |
|
const Digraph* digraph;
|
|
121 |
const Digraph* _digraph;
|
122 |
122 |
public:
|
... |
... |
@@ -127,11 +127,11 @@
|
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;
|
... |
... |
@@ -143,3 +143,3 @@
|
143 |
143 |
class OutArcIt : public Arc {
|
144 |
|
const Digraph* digraph;
|
|
144 |
const Digraph* _digraph;
|
145 |
145 |
public:
|
... |
... |
@@ -150,12 +150,12 @@
|
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;
|
... |
... |
@@ -167,3 +167,3 @@
|
167 |
167 |
class InArcIt : public Arc {
|
168 |
|
const Digraph* digraph;
|
|
168 |
const Digraph* _digraph;
|
169 |
169 |
public:
|
... |
... |
@@ -174,12 +174,12 @@
|
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;
|
... |
... |
@@ -192,4 +192,4 @@
|
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 |
}
|
... |
... |
@@ -199,4 +199,4 @@
|
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 |
}
|
... |
... |
@@ -206,4 +206,4 @@
|
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 |
}
|
... |
... |
@@ -213,4 +213,4 @@
|
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 |
}
|
... |
... |
@@ -326,3 +326,3 @@
|
326 |
326 |
|
327 |
|
/// \ingroup graphbits
|
|
327 |
/// \ingroup _graphbits
|
328 |
328 |
///
|
... |
... |
@@ -334,3 +334,3 @@
|
334 |
334 |
typedef Base Parent;
|
335 |
|
typedef GraphExtender Digraph;
|
|
335 |
typedef GraphExtender Graph;
|
336 |
336 |
|
... |
... |
@@ -377,4 +377,4 @@
|
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 |
}
|
... |
... |
@@ -382,4 +382,4 @@
|
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 |
}
|
... |
... |
@@ -416,3 +416,3 @@
|
416 |
416 |
class NodeIt : public Node {
|
417 |
|
const Digraph* digraph;
|
|
417 |
const Graph* _graph;
|
418 |
418 |
public:
|
... |
... |
@@ -423,11 +423,11 @@
|
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;
|
... |
... |
@@ -439,3 +439,3 @@
|
439 |
439 |
class ArcIt : public Arc {
|
440 |
|
const Digraph* digraph;
|
|
440 |
const Graph* _graph;
|
441 |
441 |
public:
|
... |
... |
@@ -446,11 +446,11 @@
|
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;
|
... |
... |
@@ -462,3 +462,3 @@
|
462 |
462 |
class OutArcIt : public Arc {
|
463 |
|
const Digraph* digraph;
|
|
463 |
const Graph* _graph;
|
464 |
464 |
public:
|
... |
... |
@@ -469,12 +469,12 @@
|
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;
|
... |
... |
@@ -486,3 +486,3 @@
|
486 |
486 |
class InArcIt : public Arc {
|
487 |
|
const Digraph* digraph;
|
|
487 |
const Graph* _graph;
|
488 |
488 |
public:
|
... |
... |
@@ -493,12 +493,12 @@
|
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;
|
... |
... |
@@ -510,3 +510,3 @@
|
510 |
510 |
class EdgeIt : public Parent::Edge {
|
511 |
|
const Digraph* digraph;
|
|
511 |
const Graph* _graph;
|
512 |
512 |
public:
|
... |
... |
@@ -517,11 +517,11 @@
|
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;
|
... |
... |
@@ -531,23 +531,23 @@
|
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;
|
... |
... |
@@ -559,4 +559,4 @@
|
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 |
}
|
... |
... |
@@ -566,4 +566,4 @@
|
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 |
}
|
... |
... |
@@ -573,4 +573,4 @@
|
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 |
}
|
... |
... |
@@ -580,4 +580,4 @@
|
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 |
}
|
... |
... |
@@ -587,4 +587,4 @@
|
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 |
}
|
... |
... |
@@ -593,4 +593,4 @@
|
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 |
}
|
... |
... |
@@ -601,11 +601,11 @@
|
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 |
|
... |
... |
@@ -625,11 +625,11 @@
|
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 |
|
... |
... |
@@ -649,12 +649,12 @@
|
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 |
|
... |
... |
@@ -697,6 +697,6 @@
|
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();
|
... |
... |
@@ -725,6 +725,6 @@
|
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);
|