make public the shiftedStart inorder to compute just n dijkstra
authordeba
Fri, 27 Jan 2006 14:32:33 +0000
changeset 1916e7d4eb908e87
parent 1915 f1f523d39d32
child 1917 87d3518d73d8
make public the shiftedStart inorder to compute just n dijkstra
lemon/johnson.h
     1.1 --- a/lemon/johnson.h	Fri Jan 27 14:18:11 2006 +0000
     1.2 +++ b/lemon/johnson.h	Fri Jan 27 14:32:33 2006 +0000
     1.3 @@ -483,11 +483,39 @@
     1.4        return *this;
     1.5      }
     1.6  
     1.7 -  protected:
     1.8 -    
     1.9 +  public:    
    1.10 +
    1.11 +    ///\name Execution control
    1.12 +    /// The simplest way to execute the algorithm is to use
    1.13 +    /// one of the member functions called \c run(...).
    1.14 +    /// \n
    1.15 +    /// If you need more control on the execution,
    1.16 +    /// Finally \ref start() will perform the actual path
    1.17 +    /// computation.
    1.18 +
    1.19 +    ///@{
    1.20 +
    1.21 +    /// \brief Initializes the internal data structures.
    1.22 +    /// 
    1.23 +    /// Initializes the internal data structures.
    1.24 +    void init() {
    1.25 +      create_maps();
    1.26 +    }
    1.27 +
    1.28 +    /// \brief Executes the algorithm with own potential map.
    1.29 +    ///
    1.30 +    /// This method runs the %Johnson algorithm in order to compute 
    1.31 +    /// the shortest path to each node pairs. The potential map
    1.32 +    /// can be given for this algorithm which usually calculated
    1.33 +    /// by the Bellman-Ford algorithm. If the graph does not have
    1.34 +    /// negative length edge then this start function can be used
    1.35 +    /// with constMap<Node, int>(0) parameter to omit the running time of
    1.36 +    /// the Bellman-Ford. 
    1.37 +    /// The algorithm computes 
    1.38 +    /// - The shortest path tree for each node.
    1.39 +    /// - The distance between each node pairs.
    1.40      template <typename PotentialMap>
    1.41 -    void shiftedRun(const PotentialMap& potential) {
    1.42 -      
    1.43 +    void shiftedStart(const PotentialMap& potential) {      
    1.44        typename Graph::template EdgeMap<Value> shiftlen(*graph);
    1.45        for (EdgeIt it(*graph);  it != INVALID; ++it) {
    1.46        	shiftlen[it] = (*length)[it] 
    1.47 @@ -516,25 +544,6 @@
    1.48        }
    1.49      }
    1.50  
    1.51 -  public:    
    1.52 -
    1.53 -    ///\name Execution control
    1.54 -    /// The simplest way to execute the algorithm is to use
    1.55 -    /// one of the member functions called \c run(...).
    1.56 -    /// \n
    1.57 -    /// If you need more control on the execution,
    1.58 -    /// Finally \ref start() will perform the actual path
    1.59 -    /// computation.
    1.60 -
    1.61 -    ///@{
    1.62 -
    1.63 -    /// \brief Initializes the internal data structures.
    1.64 -    /// 
    1.65 -    /// Initializes the internal data structures.
    1.66 -    void init() {
    1.67 -      create_maps();
    1.68 -    }
    1.69 -
    1.70      /// \brief Executes the algorithm.
    1.71      ///
    1.72      /// This method runs the %Johnson algorithm in order to compute 
    1.73 @@ -558,7 +567,7 @@
    1.74        bellmanford.init(OperationTraits::zero());
    1.75        bellmanford.start();
    1.76  
    1.77 -      shiftedRun(bellmanford.distMap());
    1.78 +      shiftedStart(bellmanford.distMap());
    1.79      }
    1.80  
    1.81      /// \brief Executes the algorithm and checks the negatvie cycles.
    1.82 @@ -585,7 +594,7 @@
    1.83        bellmanford.init(OperationTraits::zero());
    1.84        if (!bellmanford.checkedStart()) return false;
    1.85  
    1.86 -      shiftedRun(bellmanford.distMap());
    1.87 +      shiftedStart(bellmanford.distMap());
    1.88        return true;
    1.89      }
    1.90