[pgrouting-dev] Returning the correct edge id from boost_dijkstra_* functions

Stephen Woodbridge woodbri at swoodbridge.com
Thu Jun 30 12:42:51 EDT 2011


Anton, Daniel,

I have been fighting with the dijkstra results because we do not return 
things like the parent id of a path and we definitely do not return the 
correct edge ids.

So with some help from the boost users list and banging my head against 
the C++ wall, being only a C programmer :), I have some code that works 
for me.

http://pastebin.com/qa1caiXs

In dijkstra.h I also have defined the following structs:

typedef struct edge
{
     int id;
     int source;
     int target;
     float8 cost;
     float8 rcost;
} edge_t;

typedef struct path_element
{
     int vertex_id;
     int parent_id;
     int edge_id;
     float8 cost;
} path_element_t;

You should be able to copy the appropriate parts of this file and update 
the driving distance code and the low level dijkstra code to return more 
correct and useful results. I'm using this code outside of the 
postgresql server, but it should not require any significant changes. 
Since I'm not developing code in the database, I will leave that as an 
exercise for you guys to work out and test.

Thanks,
   -Steve


More information about the pgrouting-dev mailing list