COIN-OR::LEMON - Graph Library

Changeset 2439:3f1c7a6c33cd in lemon-0.x for lemon/dijkstra.h


Ignore:
Timestamp:
05/07/07 10:49:57 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3276
Message:

Modified start() function in Dfs and Dijkstra classes to give back reached
edge/node.

Patch from Peter Kovacs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dijkstra.h

    r2391 r2439  
    602602    Node nextNode()
    603603    {
    604       return _heap->empty()?_heap->top():INVALID;
     604      return !_heap->empty()?_heap->top():INVALID;
    605605    }
    606606 
     
    665665    ///\param nm must be a bool (or convertible) node map. The algorithm
    666666    ///will stop when it reaches a node \c v with <tt>nm[v]==true</tt>.
     667    ///
     668    ///\return The reached node \c v with <tt>nm[v]==true<\tt> or
     669    ///\c INVALID if no such node was found.
    667670    template<class NodeBoolMap>
    668     void start(const NodeBoolMap &nm)
     671    Node start(const NodeBoolMap &nm)
    669672    {
    670673      while ( !_heap->empty() && !nm[_heap->top()] ) processNextNode();
    671       if ( !_heap->empty() ) finalizeNodeData(_heap->top(),_heap->prio());
     674      if ( _heap->empty() ) return INVALID;
     675      finalizeNodeData(_heap->top(),_heap->prio());
     676      return _heap->top();
    672677    }
    673678   
Note: See TracChangeset for help on using the changeset viewer.