Boost logo

Boost Users :

Subject: [Boost-users] Problem with dijkstra_shortest_paths
From: Stephen Woodbridge (woodbri_at_[hidden])
Date: 2011-06-29 18:07:23

Hi all,

I am C programmer floundering in a C++ world!
I have the function that I call from C that builds a graph, runs
dijkstra_shortest_paths(), then extracts the results and passes them
back to a C array of structs. Code is in pastebin:

This seems to work and everything looks ok, EXCEPT the edge ids are not
correct. I suspect this is because I'm not doing something correctly and
I have been messing with this for a couple weeks without success, so I
think its time to ask for help.

So in the function:

graph_add_edge(G &graph, int id, int source, int target, float8 cost)

id is the edge id
source is the node id at the start of the edge
target is the node_id at the end of the edge
cost is the cost to traverse the edge from source to target

I would really appreciate it if someone could look at this and point out
what I might be doing wrong.

Thanks in advance,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at