1.1 --- a/lemon/bits/undir_graph_extender.h Thu Aug 11 15:24:24 2005 +0000
1.2 +++ b/lemon/bits/undir_graph_extender.h Thu Aug 11 15:55:17 2005 +0000
1.3 @@ -42,23 +42,11 @@
1.4 // be reasonable to syncronize...
1.5 bool forward;
1.6
1.7 - public:
1.8 - Edge() {}
1.9 -
1.10 - /// \brief Directed edge from undirected edge and a direction.
1.11 - ///
1.12 - /// This constructor is not a part of the concept interface of
1.13 - /// undirected graph, so please avoid using it if possible!
1.14 Edge(const UndirEdge &ue, bool _forward) :
1.15 UndirEdge(ue), forward(_forward) {}
1.16
1.17 - /// \brief Directed edge from undirected edge and a source node.
1.18 - ///
1.19 - /// Constructs a directed edge from undirected edge and a source node.
1.20 - ///
1.21 - /// \note You have to specify the graph for this constructor.
1.22 - Edge(const Graph &g, const UndirEdge &ue, const Node &n) :
1.23 - UndirEdge(ue) { forward = (g.source(ue) == n); }
1.24 + public:
1.25 + Edge() {}
1.26
1.27 /// Invalid edge constructor
1.28 Edge(Invalid i) : UndirEdge(i), forward(true) {}
1.29 @@ -79,7 +67,7 @@
1.30 /// \brief Edge of opposite direction.
1.31 ///
1.32 /// Returns the Edge of opposite direction.
1.33 - Edge opposite(const Edge &e) const {
1.34 + Edge oppositeEdge(const Edge &e) const {
1.35 return Edge(e,!e.forward);
1.36 }
1.37
1.38 @@ -114,13 +102,6 @@
1.39 return _dirTarget(e);
1.40 }
1.41
1.42 - /// Returns whether the given directed edge is same orientation as the
1.43 - /// corresponding undirected edge.
1.44 - ///
1.45 - /// \todo reference to the corresponding point of the undirected graph
1.46 - /// concept. "What does the direction of an undirected edge mean?"
1.47 - bool forward(const Edge &e) const { return e.forward; }
1.48 -
1.49 Node oppositeNode(const Node &n, const UndirEdge &e) const {
1.50 if( n == Parent::source(e))
1.51 return Parent::target(e);
1.52 @@ -130,18 +111,32 @@
1.53 return INVALID;
1.54 }
1.55
1.56 - /// Directed edge from an undirected edge and a source node.
1.57 + /// \brief Directed edge from an undirected edge and a source node.
1.58 ///
1.59 /// Returns a (directed) Edge corresponding to the specified UndirEdge
1.60 /// and source Node.
1.61 ///
1.62 - ///\todo Do we need this?
1.63 + Edge direct(const UndirEdge &ue, const Node &s) const {
1.64 + return Edge(ue, s == source(ue));
1.65 + }
1.66 +
1.67 + /// \brief Directed edge from an undirected edge.
1.68 ///
1.69 - ///\todo Better name...
1.70 - Edge edgeWithSource(const UndirEdge &ue, const Node &s) const {
1.71 - return Edge(*this, ue, s);
1.72 + /// Returns a directed edge corresponding to the specified UndirEdge.
1.73 + /// If the given bool is true the given undirected edge and the
1.74 + /// returned edge have the same source node.
1.75 + Edge direct(const UndirEdge &ue, bool d) const {
1.76 + return Edge(ue, d);
1.77 }
1.78
1.79 + /// Returns whether the given directed edge is same orientation as the
1.80 + /// corresponding undirected edge.
1.81 + ///
1.82 + /// \todo reference to the corresponding point of the undirected graph
1.83 + /// concept. "What does the direction of an undirected edge mean?"
1.84 + bool direction(const Edge &e) const { return e.forward; }
1.85 +
1.86 +
1.87 using Parent::first;
1.88 void first(Edge &e) const {
1.89 Parent::first(e);