# HG changeset patch # User Peter Kovacs # Date 1254146000 -7200 # Node ID 6f10c6ec5a21c7d42d3dab98ef84bc936c1142ea # Parent 0977046c60d27196e3b008fe9f65350180ec5362 Small fixes related to BellmanFord (#51) - Add a missing #include. - Add a missing const keyword for negativeCycle(). - Test if negativeCycle() is const function. diff -r 0977046c60d2 -r 6f10c6ec5a21 lemon/bellman_ford.h --- a/lemon/bellman_ford.h Sat Sep 26 07:21:54 2009 +0200 +++ b/lemon/bellman_ford.h Mon Sep 28 15:53:20 2009 +0200 @@ -23,6 +23,7 @@ /// \file /// \brief Bellman-Ford algorithm. +#include #include #include #include @@ -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 negativeCycle() { + lemon::Path negativeCycle() const { typename Digraph::template NodeMap state(*_gr, -1); lemon::Path cycle; for (int i = 0; i < int(_process.size()); ++i) { diff -r 0977046c60d2 -r 6f10c6ec5a21 test/bellman_ford_test.cc --- a/test/bellman_ford_test.cc Sat Sep 26 07:21:54 2009 +0200 +++ b/test/bellman_ford_test.cc Mon Sep 28 15:53:20 2009 +0200 @@ -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(); } }