diff -r 5e0d97823ba2 -r 2fb5ceac10e7 lemon/dijkstra.h --- a/lemon/dijkstra.h Fri Oct 21 13:32:12 2005 +0000 +++ b/lemon/dijkstra.h Mon Oct 24 08:09:59 2005 +0000 @@ -22,6 +22,7 @@ ///\brief Dijkstra algorithm. /// ///\todo getPath() should be implemented! (also for BFS and DFS) +///\todo dijkstraZero() solution should be revised. #include #include @@ -31,7 +32,7 @@ namespace lemon { - + template T dijkstraZero() {return 0;} ///Default traits class of Dijkstra class. @@ -499,7 +500,7 @@ ///It checks if the node has already been added to the heap and ///It is pushed to the heap only if either it was not in the heap ///or the shortest path found till then is longer then \c dst. - void addSource(Node s,Value dst=0) + void addSource(Node s,Value dst=dijkstraZero()) { if(_heap->state(s) != Heap::IN_HEAP) { _heap->push(s,dst); @@ -659,7 +660,7 @@ init(); addSource(s); start(t); - return (*_pred)[t]==INVALID?0:(*_dist)[t]; + return (*_pred)[t]==INVALID?dijkstraZero():(*_dist)[t]; } ///@} @@ -746,6 +747,14 @@ ///\pre \ref run() must be called before using this function. /// bool reached(Node v) { return (*_heap_cross_ref)[v] != Heap::PRE_HEAP; } + + ///Checks if a node is processed. + + ///Returns \c true if \c v is processed, i.e. the shortest + ///path to \c v has already found. + ///\pre \ref run() must be called before using this function. + /// + bool processed(Node v) { return (*_heap_cross_ref)[v] == Heap::POST_HEAP; } ///@} };