Is bellman_ford_shortest_paths supposed to work for undirected graphs?

int main()
{
enum {A,B,Z};
char const name[] = "ABZ";
int const numVertex = static_cast<int>(Z);
typedef std::pair
Graph;
Graph g(edge_array, edge_array + numEdges, numVertex);
Graph::edge_iterator ei, ei_end;
property_map

See the post of Jan de Ruiter. Seems he has discovered a bug with johnson_all_shortest_paths. And Johnson uses bellman_ford. I think we should notify the BGL developers of these problem. Please post your problem on the boost.devel newsgroup. Sadly, i have to use MSVC, so i'm unable to compile johnson... since there is no unnamed version yet.

Hi Matthias, On Thu, 25 Jul 2002, Matthias Kronenberger wrote: mkrone> mkrone> Sadly, i have to use MSVC, so i'm unable to compile johnson... mkrone> since there is no unnamed version yet. I've checked in an unnamed version of the Johnson all-pairs shortest path algorithm. However, I have not yet tested it with MSVC. Regards, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------

Yes, the bellman ford algorithm is suppost to work for undirected graphs, however, it looks like there was a problem in the algorithm with respect to undirected graphs. The relax function did not take the undirectedness of the edges into account. I've fixed this problem and checked the fix into CVS. On Thu, 25 Jul 2002, Louis Lavery wrote: Louis> int main() Louis> { Louis> enum {A,B,Z}; Louis> char const name[] = "ABZ"; Louis> Louis> int const numVertex = static_cast<int>(Z); Also, the above makes numVertex == 2, which is not currect. You want numVertex == 3. Louis> Expected Output:- Louis> A: 0 A Louis> B: 11 A Louis> Louis> Actual Output:- Louis> A: 0 A Louis> B: 2147483647 B Here's the output I get now: A: 0 A B: 11 A Z: inf Z Cheers, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
participants (3)
-
Jeremy Siek
-
Louis Lavery
-
Matthias Kronenberger