Dijkstra shortest path

Hi
I made a little change to example from manual which search shortest path
http://www.boost.org/doc/libs/1_37_0/libs/graph/example/dijkstra-example.cpp
http://www.boost.org/doc/libs/1_37_0/libs/graph/example/dijkstra-example.cpp
by adding add_edge function but is seams to give incorect results
#include

AMDG dwaem wrote:
int weight[] = {1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7};
<snip>
it shows distances and parents: distance(A) = 0, parent(A) = C distance(B) = 0, parent(B) = A distance(C) = 0, parent(C) = C distance(D) = 0, parent(D) = C distance(E) = 0, parent(E) = C
which makes no sense.
You're not using the weight array anywhere, so you get the default weight of 0 for every edge. In Christ, Steven Watanabe

Steven Watanabe-4 wrote:
AMDG
dwaem wrote:
int weight[] = {1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7};
<snip>
it shows distances and parents: distance(A) = 0, parent(A) = C distance(B) = 0, parent(B) = A distance(C) = 0, parent(C) = C distance(D) = 0, parent(D) = C distance(E) = 0, parent(E) = C
which makes no sense.
You're not using the weight array anywhere, so you get the default weight of 0 for every edge.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Yes this is my obviouse oversight. But now when I have founded shortest path from node A to node B. How to display full path from A to B, not only parent of the last node. -- View this message in context: http://www.nabble.com/Dijkstra-shortest-path-tp22626827p22662345.html Sent from the Boost - Users mailing list archive at Nabble.com.
participants (2)
-
dwaem
-
Steven Watanabe