[Lemon-commits] Peter Kovacs: Small fixes related to BellmanFord...
Lemon HG
hg at lemon.cs.elte.hu
Thu Nov 5 10:35:05 CET 2009
details: http://lemon.cs.elte.hu/hg/lemon/rev/6f10c6ec5a21
changeset: 841:6f10c6ec5a21
user: Peter Kovacs <kpeter [at] inf.elte.hu>
date: Mon Sep 28 15:53:20 2009 +0200
description:
Small fixes related to BellmanFord (#51)
- Add a missing #include.
- Add a missing const keyword for negativeCycle().
- Test if negativeCycle() is const function.
diffstat:
lemon/bellman_ford.h | 3 ++-
test/bellman_ford_test.cc | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diffs (39 lines):
diff --git a/lemon/bellman_ford.h b/lemon/bellman_ford.h
--- a/lemon/bellman_ford.h
+++ b/lemon/bellman_ford.h
@@ -23,6 +23,7 @@
/// \file
/// \brief Bellman-Ford algorithm.
+#include <lemon/list_graph.h>
#include <lemon/bits/path_dump.h>
#include <lemon/core.h>
#include <lemon/error.h>
@@ -775,7 +776,7 @@
/// This function gives back a directed cycle with negative total
/// length if the algorithm has already found one.
/// Otherwise it gives back an empty path.
- lemon::Path<Digraph> negativeCycle() {
+ lemon::Path<Digraph> negativeCycle() const {
typename Digraph::template NodeMap<int> state(*_gr, -1);
lemon::Path<Digraph> cycle;
for (int i = 0; i < int(_process.size()); ++i) {
diff --git a/test/bellman_ford_test.cc b/test/bellman_ford_test.cc
--- a/test/bellman_ford_test.cc
+++ b/test/bellman_ford_test.cc
@@ -96,6 +96,7 @@
d = const_bf_test.distMap();
p = const_bf_test.predMap();
pp = const_bf_test.path(t);
+ pp = const_bf_test.negativeCycle();
for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {}
}
@@ -132,6 +133,7 @@
s = bf_test.predNode(t);
b = bf_test.reached(t);
pp = bf_test.path(t);
+ pp = bf_test.negativeCycle();
}
}
More information about the Lemon-commits
mailing list