lemon/bits/iterable_graph_extender.h
changeset 1704 467d7927a901
parent 1627 3fd1ba6e9872
child 1820 22099ef840d7
     1.1 --- a/lemon/bits/iterable_graph_extender.h	Wed Oct 05 13:15:47 2005 +0000
     1.2 +++ b/lemon/bits/iterable_graph_extender.h	Wed Oct 05 13:17:42 2005 +0000
     1.3 @@ -216,30 +216,25 @@
     1.4  
     1.5      class IncEdgeIt : public Parent::UndirEdge { 
     1.6        const Graph* graph;
     1.7 -      bool forward;
     1.8 +      bool direction;
     1.9        friend class IterableUndirGraphExtender;
    1.10 -      template <typename G>
    1.11 -      friend class UndirGraphExtender;
    1.12      public:
    1.13  
    1.14        IncEdgeIt() { }
    1.15  
    1.16 -      IncEdgeIt(Invalid i) : UndirEdge(i), forward(false) { }
    1.17 +      IncEdgeIt(Invalid i) : UndirEdge(i), direction(false) { }
    1.18  
    1.19 -      IncEdgeIt(const Graph& _graph, const Node &n)
    1.20 -	: graph(&_graph)
    1.21 -      {
    1.22 -	_graph._dirFirstOut(*this, n);
    1.23 +      IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
    1.24 +	_graph.firstInc(*this, direction, n);
    1.25        }
    1.26  
    1.27        IncEdgeIt(const Graph& _graph, const UndirEdge &ue, const Node &n)
    1.28 -	: graph(&_graph), UndirEdge(ue)
    1.29 -      {
    1.30 -	forward = (_graph.source(ue) == n);
    1.31 +	: graph(&_graph), UndirEdge(ue) {
    1.32 +	direction = (_graph.source(ue) == n);
    1.33        }
    1.34  
    1.35        IncEdgeIt& operator++() {
    1.36 -	graph->_dirNextOut(*this);
    1.37 +	graph->nextInc(*this, direction);
    1.38  	return *this; 
    1.39        }
    1.40      };
    1.41 @@ -251,13 +246,13 @@
    1.42      ///
    1.43      /// Returns the base node of the iterator
    1.44      Node baseNode(const IncEdgeIt &e) const {
    1.45 -      return _dirSource(e);
    1.46 +      return e.direction ? source(e) : target(e);
    1.47      }
    1.48      /// Running node of the iterator
    1.49      ///
    1.50      /// Returns the running node of the iterator
    1.51      Node runningNode(const IncEdgeIt &e) const {
    1.52 -      return _dirTarget(e);
    1.53 +      return e.direction ? target(e) : source(e);
    1.54      }
    1.55  
    1.56      /// \brief The opposite node on the given undirected edge.