Using Arc instead of ArcIt in Dfs (#32)
authorBalazs Dezso <deba@inf.elte.hu>
Sun, 17 Aug 2008 15:02:03 +0200
changeset 119915282595e6f4
parent 1198 2236d00ca778
child 1200 73bd8d5200df
Using Arc instead of ArcIt in Dfs (#32)
lemon/dfs.h
     1.1 --- a/lemon/dfs.h	Thu Nov 01 19:49:51 2018 +0100
     1.2 +++ b/lemon/dfs.h	Sun Aug 17 15:02:03 2008 +0200
     1.3 @@ -181,7 +181,7 @@
     1.4      //Indicates if _processed is locally allocated (true) or not.
     1.5      bool local_processed;
     1.6  
     1.7 -    std::vector<typename Digraph::OutArcIt> _stack;
     1.8 +    std::vector<typename Digraph::Arc> _stack;
     1.9      int _stack_head;
    1.10  
    1.11      //Creates the maps if necessary.
    1.12 @@ -457,7 +457,8 @@
    1.13          {
    1.14            _reached->set(s,true);
    1.15            _pred->set(s,INVALID);
    1.16 -          OutArcIt e(*G,s);
    1.17 +          Arc e;
    1.18 +          G->firstOut(e,s);
    1.19            if(e!=INVALID) {
    1.20              _stack[++_stack_head]=e;
    1.21              _dist->set(s,_stack_head);
    1.22 @@ -484,19 +485,19 @@
    1.23          _pred->set(m,e);
    1.24          _reached->set(m,true);
    1.25          ++_stack_head;
    1.26 -        _stack[_stack_head] = OutArcIt(*G, m);
    1.27 +        G->firstOut(_stack[_stack_head],m);
    1.28          _dist->set(m,_stack_head);
    1.29        }
    1.30        else {
    1.31          m=G->source(e);
    1.32 -        ++_stack[_stack_head];
    1.33 +        G->nextOut(_stack[_stack_head]);
    1.34        }
    1.35        while(_stack_head>=0 && _stack[_stack_head]==INVALID) {
    1.36          _processed->set(m,true);
    1.37          --_stack_head;
    1.38          if(_stack_head>=0) {
    1.39            m=G->source(_stack[_stack_head]);
    1.40 -          ++_stack[_stack_head];
    1.41 +          G->nextOut(_stack[_stack_head]);
    1.42          }
    1.43        }
    1.44        return e;
    1.45 @@ -510,7 +511,7 @@
    1.46      ///is empty.
    1.47      OutArcIt nextArc() const
    1.48      {
    1.49 -      return _stack_head>=0?_stack[_stack_head]:INVALID;
    1.50 +      return OutArcIt(*G,_stack_head>=0?_stack[_stack_head]:INVALID);
    1.51      }
    1.52  
    1.53      ///Returns \c false if there are nodes to be processed.