lemon/dijkstra.h
changeset 2439 3f1c7a6c33cd
parent 2391 14a343be7a5a
child 2443 14abfa02bf42
     1.1 --- a/lemon/dijkstra.h	Mon May 07 08:48:40 2007 +0000
     1.2 +++ b/lemon/dijkstra.h	Mon May 07 08:49:57 2007 +0000
     1.3 @@ -601,7 +601,7 @@
     1.4      /// is empty.
     1.5      Node nextNode()
     1.6      { 
     1.7 -      return _heap->empty()?_heap->top():INVALID;
     1.8 +      return !_heap->empty()?_heap->top():INVALID;
     1.9      }
    1.10   
    1.11      ///\brief Returns \c false if there are nodes
    1.12 @@ -664,11 +664,16 @@
    1.13      ///
    1.14      ///\param nm must be a bool (or convertible) node map. The algorithm
    1.15      ///will stop when it reaches a node \c v with <tt>nm[v]==true</tt>.
    1.16 +    ///
    1.17 +    ///\return The reached node \c v with <tt>nm[v]==true<\tt> or
    1.18 +    ///\c INVALID if no such node was found.
    1.19      template<class NodeBoolMap>
    1.20 -    void start(const NodeBoolMap &nm)
    1.21 +    Node start(const NodeBoolMap &nm)
    1.22      {
    1.23        while ( !_heap->empty() && !nm[_heap->top()] ) processNextNode();
    1.24 -      if ( !_heap->empty() ) finalizeNodeData(_heap->top(),_heap->prio());
    1.25 +      if ( _heap->empty() ) return INVALID;
    1.26 +      finalizeNodeData(_heap->top(),_heap->prio());
    1.27 +      return _heap->top();
    1.28      }
    1.29      
    1.30      ///Runs %Dijkstra algorithm from node \c s.