# HG changeset patch # User deba # Date 1138372353 0 # Node ID e7d4eb908e8733454aa3457be09245f658620367 # Parent f1f523d39d327e964f5f452fc365b268dbc7bc5c make public the shiftedStart inorder to compute just n dijkstra diff -r f1f523d39d32 -r e7d4eb908e87 lemon/johnson.h --- a/lemon/johnson.h Fri Jan 27 14:18:11 2006 +0000 +++ b/lemon/johnson.h Fri Jan 27 14:32:33 2006 +0000 @@ -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(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 - void shiftedRun(const PotentialMap& potential) { - + void shiftedStart(const PotentialMap& potential) { typename Graph::template EdgeMap 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; }