diff -r ce9438c5a82d -r 4297098d9677 src/hugo/dijkstra.h --- a/src/hugo/dijkstra.h Wed Aug 25 18:55:57 2004 +0000 +++ b/src/hugo/dijkstra.h Mon Aug 30 12:01:47 2004 +0000 @@ -84,6 +84,9 @@ DistMap *distance; bool local_distance; + //The source node of the last execution. + Node source; + ///Initialize maps ///\todo Error if \c G or are \c NULL. What about \c length? @@ -212,7 +215,9 @@ init_maps(); - for ( NodeIt u(*G) ; G->valid(u) ; G->next(u) ) { + source = s; + + for ( NodeIt u(*G) ; u!=INVALID ; ++u ) { predecessor->set(u,INVALID); pred_node->set(u,INVALID); } @@ -235,8 +240,8 @@ distance->set(v, oldvalue); - for(OutEdgeIt e(*G,v); G->valid(e); G->next(e)) { - Node w=G->bNode(e); + for(OutEdgeIt e(*G,v); e!=INVALID; ++e) { + Node w=G->head(e); switch(heap.state(w)) { case HeapType::PRE_HEAP: @@ -310,11 +315,10 @@ ///Checks if a node is reachable from the root. ///Returns \c true if \c v is reachable from the root. - ///\warning the root node is reported to be unreached! - ///\todo Is this what we want? + ///\warning the root node is reported to be reached! ///\pre \ref run() must be called before using this function. /// - bool reached(Node v) { return G->valid((*predecessor)[v]); } + bool reached(Node v) { return v==source || (*predecessor)[v]==INVALID; } };