[Lemon-commits] Peter Kovacs: Bug fix + doc improvement in Undir...
Lemon HG
hg at lemon.cs.elte.hu
Wed Sep 10 14:04:34 CEST 2008
details: http://lemon.cs.elte.hu/hg/lemon/rev/c760d691fe3c
changeset: 256:c760d691fe3c
user: Peter Kovacs <kpeter [at] inf.elte.hu>
date: Tue Sep 02 22:27:19 2008 +0200
description:
Bug fix + doc improvement in UndirDigraphExtender (ticket #141)
diffstat:
1 file changed, 19 insertions(+), 17 deletions(-)
lemon/bits/base_extender.h | 36 +++++++++++++++++++-----------------
diffs (77 lines):
diff -r 914c5432be97 -r c760d691fe3c lemon/bits/base_extender.h
--- a/lemon/bits/base_extender.h Tue Sep 02 10:23:23 2008 +0100
+++ b/lemon/bits/base_extender.h Tue Sep 02 22:27:19 2008 +0200
@@ -59,7 +59,7 @@
public:
Arc() {}
- /// Invalid arc constructor
+ // Invalid arc constructor
Arc(Invalid i) : Edge(i), forward(true) {}
bool operator==(const Arc &that) const {
@@ -74,38 +74,41 @@
}
};
+ /// First node of the edge
+ Node u(const Edge &e) const {
+ return Parent::source(e);
+ }
-
- using Parent::source;
-
- /// Source of the given Arc.
+ /// Source of the given arc
Node source(const Arc &e) const {
return e.forward ? Parent::source(e) : Parent::target(e);
}
- using Parent::target;
+ /// Second node of the edge
+ Node v(const Edge &e) const {
+ return Parent::target(e);
+ }
- /// Target of the given Arc.
+ /// Target of the given arc
Node target(const Arc &e) const {
return e.forward ? Parent::target(e) : Parent::source(e);
}
/// \brief Directed arc from an edge.
///
- /// Returns a directed arc corresponding to the specified Edge.
- /// If the given bool is true the given edge and the
- /// returned arc have the same source node.
- static Arc direct(const Edge &ue, bool d) {
- return Arc(ue, d);
+ /// Returns a directed arc corresponding to the specified edge.
+ /// If the given bool is true, the first node of the given edge and
+ /// the source node of the returned arc are the same.
+ static Arc direct(const Edge &e, bool d) {
+ return Arc(e, d);
}
- /// Returns whether the given directed arc is same orientation as the
- /// corresponding edge.
+ /// Returns whether the given directed arc has the same orientation
+ /// as the corresponding edge.
///
/// \todo reference to the corresponding point of the undirected digraph
/// concept. "What does the direction of an edge mean?"
- static bool direction(const Arc &e) { return e.forward; }
-
+ static bool direction(const Arc &a) { return a.forward; }
using Parent::first;
using Parent::next;
@@ -228,7 +231,6 @@
int maxEdgeId() const {
return Parent::maxArcId();
}
-
int arcNum() const {
return 2 * Parent::arcNum();
More information about the Lemon-commits
mailing list