# HG changeset patch # User alpar # Date 1108737964 0 # Node ID fe0fcdb5687b2e6ba671690e446df0d385c7fd5f # Parent f07c1c442e6c2c04ff44ccc31daff29f5cb9144a - Better addSource() - More docs diff -r f07c1c442e6c -r fe0fcdb5687b src/lemon/dijkstra.h --- a/src/lemon/dijkstra.h Fri Feb 18 10:36:13 2005 +0000 +++ b/src/lemon/dijkstra.h Fri Feb 18 14:46:04 2005 +0000 @@ -483,18 +483,28 @@ ///Adds a new source node. - ///Adds a new source node the the priority heap. - ///It checks if the node has already been added to the heap. + ///Adds a new source node to the priority heap. /// ///The optional second parameter is the initial distance of the node. /// - ///\todo Do we really want to check it? + ///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) { source = s; if(_heap.state(s) != Heap::IN_HEAP) _heap.push(s,dst); + else if(_heap[s]set(s,INVALID); + } } + ///Processes the next node in the priority heap + + ///Processes the next node in the priority heap. + /// + ///\warning The priority heap must not be empty! void processNextNode() { Node v=_heap.top(); @@ -523,6 +533,17 @@ } } + ///Returns \c false if there are nodes to be processed in the priority heap + + ///Returns \c false if there are nodes to be processed in the priority heap + /// + bool emptyHeap() { return heap.empty(); } + ///Returns the number of the nodes to be processed in the priority heap + + ///Returns the number of the nodes to be processed in the priority heap + /// + int heapSize() { return heap.size(); } + ///Executes the algorithm. ///Executes the algorithm.