1.1 --- a/lemon/bits/base_extender.h Tue Sep 26 12:20:22 2006 +0000
1.2 +++ b/lemon/bits/base_extender.h Fri Sep 29 11:23:54 2006 +0000
1.3 @@ -35,7 +35,7 @@
1.4
1.5 /// \ingroup graphbits
1.6 ///
1.7 - /// \brief BaseExtender for the UGraphs
1.8 + /// \brief BaseGraph to BaseUGraph extender
1.9 template <typename Base>
1.10 class UndirGraphExtender : public Base {
1.11
1.12 @@ -238,7 +238,7 @@
1.13 return Parent::edgeNum();
1.14 }
1.15
1.16 - Edge findEdge(Node source, Node target, Edge prev) const {
1.17 + Edge findEdge(Node source, Node target, Edge prev = INVALID) const {
1.18 if (prev == INVALID) {
1.19 UEdge edge = Parent::findEdge(source, target);
1.20 if (edge != INVALID) return direct(edge, true);
1.21 @@ -256,20 +256,24 @@
1.22 return INVALID;
1.23 }
1.24
1.25 - UEdge findUEdge(Node source, Node target, UEdge prev) const {
1.26 - if (prev == INVALID) {
1.27 - UEdge edge = Parent::findEdge(source, target);
1.28 - if (edge != INVALID) return edge;
1.29 - edge = Parent::findEdge(target, source);
1.30 - if (edge != INVALID) return edge;
1.31 - } else if (Parent::source(prev) == source) {
1.32 - UEdge edge = Parent::findEdge(source, target, prev);
1.33 - if (edge != INVALID) return edge;
1.34 - edge = Parent::findEdge(target, source);
1.35 - if (edge != INVALID) return edge;
1.36 + UEdge findUEdge(Node source, Node target, UEdge prev = INVALID) const {
1.37 + if (source != target) {
1.38 + if (prev == INVALID) {
1.39 + UEdge edge = Parent::findEdge(source, target);
1.40 + if (edge != INVALID) return edge;
1.41 + edge = Parent::findEdge(target, source);
1.42 + if (edge != INVALID) return edge;
1.43 + } else if (Parent::source(prev) == source) {
1.44 + UEdge edge = Parent::findEdge(source, target, prev);
1.45 + if (edge != INVALID) return edge;
1.46 + edge = Parent::findEdge(target, source);
1.47 + if (edge != INVALID) return edge;
1.48 + } else {
1.49 + UEdge edge = Parent::findEdge(target, source, prev);
1.50 + if (edge != INVALID) return edge;
1.51 + }
1.52 } else {
1.53 - UEdge edge = Parent::findEdge(target, source, prev);
1.54 - if (edge != INVALID) return edge;
1.55 + return Parent::findEdge(source, target, prev);
1.56 }
1.57 return INVALID;
1.58 }
2.1 --- a/lemon/bits/graph_extender.h Tue Sep 26 12:20:22 2006 +0000
2.2 +++ b/lemon/bits/graph_extender.h Fri Sep 29 11:23:54 2006 +0000
2.3 @@ -1523,6 +1523,14 @@
2.4 bnode_notifier.clear();
2.5 }
2.6
2.7 + Edge findEdge(Node u, Node v, Edge prev = INVALID) const {
2.8 + UEdge uedge = Parent::findUEdge(u, v, prev);
2.9 + if (uedge != INVALID) {
2.10 + return direct(uedge, Parent::aNode(u));
2.11 + } else {
2.12 + return INVALID;
2.13 + }
2.14 + }
2.15
2.16 };
2.17