Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'AllPairsShortestPath' topicStudent Support Forum > General > "AllPairsShortestPath"

Next Comment >Help | Reply To Topic
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: ,

Subject (listing for 'AllPairsShortestPath')
Author Date Posted
AllPairsShortestPath Fernando 08/09/11 12:57pm
Re: AllPairsShortestPath yehuda ben-s... 08/10/11 2:41pm
Re: Re: AllPairsShortestPath Forum Modera... 09/13/11 6:41pm
Re: AllPairsShortestPath mkc 09/13/11 6:45pm
Next Comment >Help | Reply To Topic