Bug fix in Bfs class.
authordeba
Mon, 07 May 2007 08:48:40 +0000
changeset 2438718479989797
parent 2437 02c7076bf894
child 2439 3f1c7a6c33cd
Bug fix in Bfs class.

Patch from Peter Kovacs
lemon/bfs.h
     1.1 --- a/lemon/bfs.h	Mon May 07 08:47:38 2007 +0000
     1.2 +++ b/lemon/bfs.h	Mon May 07 08:48:40 2007 +0000
     1.3 @@ -541,7 +541,7 @@
     1.4  	  _reached->set(m,true);
     1.5  	  _pred->set(m,e);
     1.6  	  _dist->set(m,_curr_dist);
     1.7 -          reached = reach || nm[m];
     1.8 +          reach = reach || nm[m];
     1.9  	}
    1.10        return n;
    1.11      }
    1.12 @@ -605,7 +605,7 @@
    1.13      void start(Node dest)
    1.14      {
    1.15        bool reach = false;
    1.16 -      while ( !emptyQueue() && !reach) processNextNode(dest, reach);
    1.17 +      while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
    1.18      }
    1.19      
    1.20      ///Executes the algorithm until a condition is met.
    1.21 @@ -623,7 +623,7 @@
    1.22      void start(const NM &nm)
    1.23      {
    1.24        bool reach = false;
    1.25 -      while ( !emptyQueue() && !reach) processNextNode(nm, reach);
    1.26 +      while ( !emptyQueue() && !reach ) processNextNode(nm, reach);
    1.27      }
    1.28      
    1.29      ///Runs %BFS algorithm from node \c s.
    1.30 @@ -664,7 +664,7 @@
    1.31        init();
    1.32        addSource(s);
    1.33        start(t);
    1.34 -      return reached(t)? _curr_dist : 0;
    1.35 +      return reached(t) ? _curr_dist : 0;
    1.36      }
    1.37      
    1.38      ///@}
    1.39 @@ -1503,9 +1503,7 @@
    1.40      /// with addSource() before using this function.
    1.41      void start(Node dest) {
    1.42        bool reach = false;
    1.43 -      while (!emptyQueue() && !reach) { 
    1.44 -	processNextNode(dest, reach);
    1.45 -      }
    1.46 +      while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
    1.47      }
    1.48      
    1.49      /// \brief Executes the algorithm until a condition is met.
    1.50 @@ -1521,9 +1519,7 @@
    1.51      template <typename NM>
    1.52      void start(const NM &nm) {
    1.53        bool reach = false;
    1.54 -      while (!emptyQueue() && !reach) {
    1.55 -        processNextNode(nm, reach);
    1.56 -      }
    1.57 +      while ( !emptyQueue() && !reach ) processNextNode(nm, reach);
    1.58      }
    1.59  
    1.60      /// \brief Runs %BFSVisit algorithm from node \c s.