[Lemon-commits] [lemon_svn] alpar: r1656 - hugo/trunk/src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:46:49 CET 2006


Author: alpar
Date: Mon Mar 21 08:47:00 2005
New Revision: 1656

Modified:
   hugo/trunk/src/lemon/dijkstra.h

Log:
Bugfix, thanks to Janos.


Modified: hugo/trunk/src/lemon/dijkstra.h
==============================================================================
--- hugo/trunk/src/lemon/dijkstra.h	(original)
+++ hugo/trunk/src/lemon/dijkstra.h	Mon Mar 21 08:47:00 2005
@@ -472,10 +472,11 @@
     ///Initializes the internal data structures.
     ///
     ///\todo _heap_map's type could also be in the traits class.
+    ///\todo The heaps should be able to make themselves empty directly.
     void init()
     {
       create_maps();
-      
+      while(!_heap.empty()) _heap.pop();
       for ( NodeIt u(*G) ; u!=INVALID ; ++u ) {
 	_pred->set(u,INVALID);
 // 	_predNode->set(u,INVALID);
@@ -584,7 +585,7 @@
     void start(Node dest)
     {
       while ( !_heap.empty() && _heap.top()!=dest ) processNextNode();
-      if ( _heap.top()==dest ) finalizeNodeData(_heap.top());
+      if ( !_heap.empty() ) finalizeNodeData(_heap.top(),_heap.prio());
     }
     
     ///Executes the algorithm until a condition is met.
@@ -600,7 +601,7 @@
     void start(const NM &nm)
     {
       while ( !_heap.empty() && !nm[_heap.top()] ) processNextNode();
-      if ( !_heap.empty() ) finalizeNodeData(_heap.top());
+      if ( !_heap.empty() ) finalizeNodeData(_heap.top(),_heap.prio());
     }
     
     ///Runs %Dijkstra algorithm from node \c s.
@@ -854,7 +855,7 @@
 
   };
   
-  /// A class to make easier the usage of Dijkstra algorithm
+  /// A class to make the usage of Dijkstra algorithm easier
 
   /// This class is created to make it easier to use Dijkstra algorithm.
   /// It uses the functions and features of the plain \ref Dijkstra,



More information about the Lemon-commits mailing list