Merge bugfix #392 to branch 1.1 1.1
authorAlpar Juttner <alpar@cs.elte.hu>
Wed, 22 Sep 2010 09:26:01 +0200
branch1.1
changeset 738c85f53572941
parent 736 d0e5734fc48e
parent 737 e24922c56bc2
child 740 075de3c84e1f
Merge bugfix #392 to branch 1.1
lemon/dfs.h
test/dfs_test.cc
     1.1 --- a/lemon/dfs.h	Tue Sep 21 06:28:35 2010 +0200
     1.2 +++ b/lemon/dfs.h	Wed Sep 22 09:26:01 2010 +0200
     1.3 @@ -557,7 +557,7 @@
     1.4      ///added with addSource() before using this function.
     1.5      void start(Node t)
     1.6      {
     1.7 -      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
     1.8 +      while ( !emptyQueue() && !(*_reached)[t] )
     1.9          processNextArc();
    1.10      }
    1.11  
    1.12 @@ -1509,7 +1509,7 @@
    1.13      /// \pre init() must be called and a root node should be added
    1.14      /// with addSource() before using this function.
    1.15      void start(Node t) {
    1.16 -      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
    1.17 +      while ( !emptyQueue() && !(*_reached)[t] )
    1.18          processNextArc();
    1.19      }
    1.20  
     2.1 --- a/test/dfs_test.cc	Tue Sep 21 06:28:35 2010 +0200
     2.2 +++ b/test/dfs_test.cc	Wed Sep 22 09:26:01 2010 +0200
     2.3 @@ -50,7 +50,10 @@
     2.4    "6 3  7\n"
     2.5    "@attributes\n"
     2.6    "source 0\n"
     2.7 -  "target 5\n";
     2.8 +  "target 5\n"
     2.9 +  "source1 6\n"
    2.10 +  "target1 3\n";
    2.11 +
    2.12  
    2.13  void checkDfsCompile()
    2.14  {
    2.15 @@ -179,11 +182,14 @@
    2.16  
    2.17    Digraph G;
    2.18    Node s, t;
    2.19 +  Node s1, t1;
    2.20  
    2.21    std::istringstream input(test_lgf);
    2.22    digraphReader(G, input).
    2.23      node("source", s).
    2.24      node("target", t).
    2.25 +    node("source1", s1).
    2.26 +    node("target1", t1).
    2.27      run();
    2.28  
    2.29    Dfs<Digraph> dfs_test(G);
    2.30 @@ -210,6 +216,11 @@
    2.31    }
    2.32  
    2.33    {
    2.34 +  Dfs<Digraph> dfs(G);
    2.35 +  check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6.");
    2.36 +  }
    2.37 +  
    2.38 +  {
    2.39      NullMap<Node,Arc> myPredMap;
    2.40      dfs(G).predMap(myPredMap).run(s);
    2.41    }