lemon/bellman_ford.h
changeset 2059 ebf3b2962554
parent 2042 bdc953f2a449
child 2070 1287ef6c180f
     1.1 --- a/lemon/bellman_ford.h	Tue Apr 18 07:01:55 2006 +0000
     1.2 +++ b/lemon/bellman_ford.h	Tue Apr 18 07:02:32 2006 +0000
     1.3 @@ -420,11 +420,20 @@
     1.4  
     1.5      /// \brief Executes one round from the bellman ford algorithm.
     1.6      ///
     1.7 -    /// If the algoritm calculated the distances in the previous round 
     1.8 -    /// strictly for all at most k length paths then it will calculate the 
     1.9 -    /// distances strictly for all at most k + 1 length paths. With k
    1.10 -    /// iteration this function calculates the at most k length paths.
    1.11 -    /// \return %True when the algorithm have not found more shorter paths.
    1.12 +    /// If the algoritm calculated the distances in the previous round
    1.13 +    /// exactly for all at most \f$ k \f$ length path lengths then it will
    1.14 +    /// calculate the distances exactly for all at most \f$ k + 1 \f$
    1.15 +    /// length path lengths. With \f$ k \f$ iteration this function
    1.16 +    /// calculates the at most \f$ k \f$ length path lengths.
    1.17 +    ///
    1.18 +    /// \warning The paths with limited edge number cannot be retrieved
    1.19 +    /// easily with \ref getPath() or \ref predEdge() functions. If you
    1.20 +    /// need the shortest path and not just the distance you should store
    1.21 +    /// after each iteration the \ref predEdgeMap() map and manually build
    1.22 +    /// the path.
    1.23 +    ///
    1.24 +    /// \return %True when the algorithm have not found more shorter
    1.25 +    /// paths.
    1.26      bool processNextRound() {
    1.27        for (int i = 0; i < (int)_process.size(); ++i) {
    1.28  	_mask->set(_process[i], false);
    1.29 @@ -526,13 +535,21 @@
    1.30      /// \pre init() must be called and at least one node should be added
    1.31      /// with addSource() before using this function.
    1.32      ///
    1.33 -    /// This method runs the %BellmanFord algorithm from the root node(s)
    1.34 -    /// in order to compute the shortest path with at most \c length edge 
    1.35 -    /// long paths to each node. The algorithm computes 
    1.36 -    /// - The shortest path tree.
    1.37 +    /// This method runs the %BellmanFord algorithm from the root
    1.38 +    /// node(s) in order to compute the shortest path lengths with at
    1.39 +    /// most \c num edge.
    1.40 +    ///
    1.41 +    /// \warning The paths with limited edge number cannot be retrieved
    1.42 +    /// easily with \ref getPath() or \ref predEdge() functions. If you
    1.43 +    /// need the shortest path and not just the distance you should store
    1.44 +    /// after each iteration the \ref predEdgeMap() map and manually build
    1.45 +    /// the path.
    1.46 +    ///
    1.47 +    /// The algorithm computes
    1.48 +    /// - The predecessor edge from each node.
    1.49      /// - The limited distance of each node from the root(s).
    1.50 -    void limitedStart(int length) {
    1.51 -      for (int i = 0; i < length; ++i) {
    1.52 +    void limitedStart(int num) {
    1.53 +      for (int i = 0; i < num; ++i) {
    1.54  	if (processNextRound()) break;
    1.55        }
    1.56      }