# HG changeset patch # User jacint # Date 1082747045 0 # Node ID d7ebbae96025333299c3fbba35564809e8c230f3 # Parent f27d21767d38c12eded4728d7a17e14a371044fb Some changes in the documentation. diff -r f27d21767d38 -r d7ebbae96025 src/include/dijkstra.h --- a/src/include/dijkstra.h Fri Apr 23 18:48:56 2004 +0000 +++ b/src/include/dijkstra.h Fri Apr 23 19:04:05 2004 +0000 @@ -1,17 +1,15 @@ // -*- C++ -*- - #ifndef HUGO_DIJKSTRA_H #define HUGO_DIJKSTRA_H ///\file ///\brief Dijkstra algorithm. -#include #include #include namespace hugo { - + ///%Dijkstra algorithm class. ///This class provides an efficient implementation of %Dijkstra algorithm. @@ -23,14 +21,17 @@ /// ///It is also possible to change the underlying priority heap. /// - ///\param Graph The graph type the algorithm runs on. - ///\param LengthMap This read-only EdgeMap determines the lengths of - ///the edges. It is read once for each edge, so the map may involve - ///in relatively time consuming process to compute the edge length - ///if it is necessary. The default map type is \ref - ///GraphSkeleton::EdgeMap "Graph::EdgeMap" - ///\param Heap The heap type used by the %Dijkstra algorithm. The - ///default is using \ref BinHeap "binary heap". + ///\param Graph The graph type the algorithm runs on. + ///\param LengthMap This read-only + ///EdgeMap + ///determines the + ///lengths of the edges. It is read once for each edge, so the map + ///may involve in relatively time consuming process to compute the edge + ///length if it is necessary. The default map type is + ///\ref GraphSkeleton::EdgeMap "Graph::EdgeMap" + ///\param Heap The heap type used by the %Dijkstra + ///algorithm. The default + ///is using \ref BinHeap "binary heap". #ifdef DOXYGEN template class Heap > void Dijkstra::run(Node s) { @@ -145,18 +153,20 @@ typename Graph::NodeMap heap_map(G,-1); Heap > heap(heap_map); + heap.push(s,0); - while ( !heap.empty() ) { - - Node v=heap.top(); - ValueType oldvalue=heap[v]; - heap.pop(); - distance.set(v, oldvalue); + while ( !heap.empty() ) { - { //FIXME this bracket is for e to be local - OutEdgeIt e; - for(G.first(e, v); G.valid(e); G.next(e)) { + Node v=heap.top(); + ValueType oldvalue=heap[v]; + heap.pop(); + distance.set(v, oldvalue); + + { //FIXME this bracket is for e to be local + OutEdgeIt e; + for(G.first(e, v); + G.valid(e); G.next(e)) { Node w=G.head(e); switch(heap.state(w)) { @@ -176,8 +186,8 @@ break; } } - } //FIXME this bracket - } + } //FIXME tis bracket + } } } //END OF NAMESPACE HUGO