[Lemon-commits] [lemon_svn] deba: r2491 - hugo/trunk/lemon

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


Author: deba
Date: Fri Jan 27 15:32:33 2006
New Revision: 2491

Modified:
   hugo/trunk/lemon/johnson.h

Log:
make public the shiftedStart inorder to compute just n dijkstra



Modified: hugo/trunk/lemon/johnson.h
==============================================================================
--- hugo/trunk/lemon/johnson.h	(original)
+++ hugo/trunk/lemon/johnson.h	Fri Jan 27 15:32:33 2006
@@ -483,11 +483,39 @@
       return *this;
     }
 
-  protected:
-    
+  public:    
+
+    ///\name Execution control
+    /// The simplest way to execute the algorithm is to use
+    /// one of the member functions called \c run(...).
+    /// \n
+    /// If you need more control on the execution,
+    /// Finally \ref start() will perform the actual path
+    /// computation.
+
+    ///@{
+
+    /// \brief Initializes the internal data structures.
+    /// 
+    /// Initializes the internal data structures.
+    void init() {
+      create_maps();
+    }
+
+    /// \brief Executes the algorithm with own potential map.
+    ///
+    /// This method runs the %Johnson algorithm in order to compute 
+    /// the shortest path to each node pairs. The potential map
+    /// can be given for this algorithm which usually calculated
+    /// by the Bellman-Ford algorithm. If the graph does not have
+    /// negative length edge then this start function can be used
+    /// with constMap<Node, int>(0) parameter to omit the running time of
+    /// the Bellman-Ford. 
+    /// The algorithm computes 
+    /// - The shortest path tree for each node.
+    /// - The distance between each node pairs.
     template <typename PotentialMap>
-    void shiftedRun(const PotentialMap& potential) {
-      
+    void shiftedStart(const PotentialMap& potential) {      
       typename Graph::template EdgeMap<Value> shiftlen(*graph);
       for (EdgeIt it(*graph);  it != INVALID; ++it) {
       	shiftlen[it] = (*length)[it] 
@@ -516,25 +544,6 @@
       }
     }
 
-  public:    
-
-    ///\name Execution control
-    /// The simplest way to execute the algorithm is to use
-    /// one of the member functions called \c run(...).
-    /// \n
-    /// If you need more control on the execution,
-    /// Finally \ref start() will perform the actual path
-    /// computation.
-
-    ///@{
-
-    /// \brief Initializes the internal data structures.
-    /// 
-    /// Initializes the internal data structures.
-    void init() {
-      create_maps();
-    }
-
     /// \brief Executes the algorithm.
     ///
     /// This method runs the %Johnson algorithm in order to compute 
@@ -558,7 +567,7 @@
       bellmanford.init(OperationTraits::zero());
       bellmanford.start();
 
-      shiftedRun(bellmanford.distMap());
+      shiftedStart(bellmanford.distMap());
     }
 
     /// \brief Executes the algorithm and checks the negatvie cycles.
@@ -585,7 +594,7 @@
       bellmanford.init(OperationTraits::zero());
       if (!bellmanford.checkedStart()) return false;
 
-      shiftedRun(bellmanford.distMap());
+      shiftedStart(bellmanford.distMap());
       return true;
     }
 



More information about the Lemon-commits mailing list