| Author |
Comment/Response |
Fernando
|
08/09/11 12:57pm
there seems to be something odd in the AllPairsShortestPath algoritm from Combinatorica.
If you run the following code on Mathematica 7 (needs to load Combinatorica):
Needs["Combinatorica`"]
nodos = Table[{Vertices[RandomGraph[3, 0]][[i]],
VertexLabel -> ToString[i]}, {i, 3}];
edges = {{{1, 2}, EdgeWeight -> 1/2}, {{1, 2},
EdgeWeight -> 1/2}, {{1, 3}, EdgeWeight -> 1/2}, {{1, 3},
EdgeWeight -> 1/2}};
g = Graph[edges, nodos];
Print[ShowGraph[g]];
AllPairsShortestPath[g]
you will get that from node 1 to 3 it takes an infinite distance when clearly the minimum distance has length 1.
Any ideas how to get rid of this problem?
Thanks.
Fernando
URL: , |
|