diff -r e251336be488 -r 3fd1ba6e9872 lemon/bits/undir_graph_extender.h --- a/lemon/bits/undir_graph_extender.h Thu Aug 11 15:24:24 2005 +0000 +++ b/lemon/bits/undir_graph_extender.h Thu Aug 11 15:55:17 2005 +0000 @@ -42,23 +42,11 @@ // be reasonable to syncronize... bool forward; - public: - Edge() {} - - /// \brief Directed edge from undirected edge and a direction. - /// - /// This constructor is not a part of the concept interface of - /// undirected graph, so please avoid using it if possible! Edge(const UndirEdge &ue, bool _forward) : UndirEdge(ue), forward(_forward) {} - /// \brief Directed edge from undirected edge and a source node. - /// - /// Constructs a directed edge from undirected edge and a source node. - /// - /// \note You have to specify the graph for this constructor. - Edge(const Graph &g, const UndirEdge &ue, const Node &n) : - UndirEdge(ue) { forward = (g.source(ue) == n); } + public: + Edge() {} /// Invalid edge constructor Edge(Invalid i) : UndirEdge(i), forward(true) {} @@ -79,7 +67,7 @@ /// \brief Edge of opposite direction. /// /// Returns the Edge of opposite direction. - Edge opposite(const Edge &e) const { + Edge oppositeEdge(const Edge &e) const { return Edge(e,!e.forward); } @@ -114,13 +102,6 @@ return _dirTarget(e); } - /// Returns whether the given directed edge is same orientation as the - /// corresponding undirected edge. - /// - /// \todo reference to the corresponding point of the undirected graph - /// concept. "What does the direction of an undirected edge mean?" - bool forward(const Edge &e) const { return e.forward; } - Node oppositeNode(const Node &n, const UndirEdge &e) const { if( n == Parent::source(e)) return Parent::target(e); @@ -130,18 +111,32 @@ return INVALID; } - /// Directed edge from an undirected edge and a source node. + /// \brief Directed edge from an undirected edge and a source node. /// /// Returns a (directed) Edge corresponding to the specified UndirEdge /// and source Node. /// - ///\todo Do we need this? + Edge direct(const UndirEdge &ue, const Node &s) const { + return Edge(ue, s == source(ue)); + } + + /// \brief Directed edge from an undirected edge. /// - ///\todo Better name... - Edge edgeWithSource(const UndirEdge &ue, const Node &s) const { - return Edge(*this, ue, s); + /// Returns a directed edge corresponding to the specified UndirEdge. + /// If the given bool is true the given undirected edge and the + /// returned edge have the same source node. + Edge direct(const UndirEdge &ue, bool d) const { + return Edge(ue, d); } + /// Returns whether the given directed edge is same orientation as the + /// corresponding undirected edge. + /// + /// \todo reference to the corresponding point of the undirected graph + /// concept. "What does the direction of an undirected edge mean?" + bool direction(const Edge &e) const { return e.forward; } + + using Parent::first; void first(Edge &e) const { Parent::first(e);