COIN-OR::LEMON - Graph Library

Changeset 1734:2fb5ceac10e7 in lemon-0.x for lemon/dijkstra.h


Ignore:
Timestamp:
10/24/05 10:09:59 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2261
Message:
  • dijkstraZero() added. (Until we conclude how to handle the related problem.)
  • processed() query function added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dijkstra.h

    r1721 r1734  
    2323///
    2424///\todo getPath() should be implemented! (also for BFS and DFS)
     25///\todo dijkstraZero() solution should be revised.
    2526
    2627#include <lemon/list_graph.h>
     
    3233namespace lemon {
    3334
    34 
     35  template<class T> T dijkstraZero() {return 0;}
    3536 
    3637  ///Default traits class of Dijkstra class.
     
    500501    ///It is pushed to the heap only if either it was not in the heap
    501502    ///or the shortest path found till then is longer then \c dst.
    502     void addSource(Node s,Value dst=0)
     503    void addSource(Node s,Value dst=dijkstraZero<Value>())
    503504    {
    504505      if(_heap->state(s) != Heap::IN_HEAP) {
     
    660661      addSource(s);
    661662      start(t);
    662       return (*_pred)[t]==INVALID?0:(*_dist)[t];
     663      return (*_pred)[t]==INVALID?dijkstraZero<Value>():(*_dist)[t];
    663664    }
    664665   
     
    747748    ///
    748749    bool reached(Node v) { return (*_heap_cross_ref)[v] != Heap::PRE_HEAP; }
     750
     751    ///Checks if a node is processed.
     752
     753    ///Returns \c true if \c v is processed, i.e. the shortest
     754    ///path to \c v has already found.
     755    ///\pre \ref run() must be called before using this function.
     756    ///
     757    bool processed(Node v) { return (*_heap_cross_ref)[v] == Heap::POST_HEAP; }
    749758   
    750759    ///@}
Note: See TracChangeset for help on using the changeset viewer.