[Lemon-commits] [lemon_svn] klao: r2425 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:52:32 CET 2006
Author: klao
Date: Sat Dec 10 20:38:53 2005
New Revision: 2425
Modified:
hugo/trunk/lemon/belmann_ford.h
Log:
belmann_ford:
* run() with length limit
* bugfix in processNextRound()
Modified: hugo/trunk/lemon/belmann_ford.h
==============================================================================
--- hugo/trunk/lemon/belmann_ford.h (original)
+++ hugo/trunk/lemon/belmann_ford.h Sat Dec 10 20:38:53 2005
@@ -430,7 +430,7 @@
std::vector<Node> nextProcess;
std::vector<Value> 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
More information about the Lemon-commits
mailing list