# HG changeset patch # User klao # Date 1134243533 0 # Node ID 2e3a4481901ef37c466751cd711a35c62430245b # Parent 3f0558065bcddedaaf9c1849d845745c613e2a48 belmann_ford: * run() with length limit * bugfix in processNextRound() diff -r 3f0558065bcd -r 2e3a4481901e lemon/belmann_ford.h --- a/lemon/belmann_ford.h Thu Dec 08 14:16:08 2005 +0000 +++ b/lemon/belmann_ford.h Sat Dec 10 19:38:53 2005 +0000 @@ -430,7 +430,7 @@ std::vector nextProcess; std::vector values(_process.size()); for (int i = 0; i < (int)_process.size(); ++i) { - values[i] = _dist[_process[i]]; + values[i] = (*_dist)[_process[i]]; } for (int i = 0; i < (int)_process.size(); ++i) { for (OutEdgeIt it(*graph, _process[i]); it != INVALID; ++it) { @@ -555,6 +555,27 @@ start(); } + /// \brief Runs %BelmannFord algorithm with limited path length + /// from node \c s. + /// + /// This method runs the %BelmannFord algorithm from a root node \c s + /// in order to compute the shortest path with at most \c len edges + /// to each node. The algorithm computes + /// - The shortest path tree. + /// - The distance of each node from the root. + /// + /// \note d.run(s, len) is just a shortcut of the following code. + /// \code + /// d.init(); + /// d.addSource(s); + /// d.limitedStart(len); + /// \endcode + void run(Node s, int len) { + init(); + addSource(s); + limitedStart(len); + } + ///@} /// \name Query Functions