[pgrouting-users] Driving Distance calculation documentation questions

Hi all,

I'm trying to map my knowledge of Driving Distance to the pgRouting function:

CREATE OR REPLACE FUNCTION driving_distance(sql text, source_id integer, distance float8, directed boolean, has_reverse_cost boolean)
  RETURNS SETOF path_result

So my assumptions (which may be invalid) are that this function does a Dijkstra search start at source_id with a search cutoff at distance. And that the result somehow represents the resulting Dijkstra tree.

If that is correct then I would expect to have a list of nodes in the tree, with the minimal cost to get from the source_id to that node. And I would expect to have multiple terminal nodes that represent the outer fringe of the search area.

So reading the documentation at:

We get back set of result_path which. Questions:

1) vertex_id: the identifier of source vertex of each edge.

Is this literally the "source" node of the edge or the source given the direction of traversal of the edge?

2) cost: It is 0 for the row after the last edge. Thus, the path total cost can be computed using a sum of all rows in the cost column.

This appears to assume a single path and not a tree of all paths out from source_id to the cutoff distance. How does one compute the cost to get to any given node in the result set.

Could someone review this doc and maybe update the doc to clarify some of this questions or discuss them here and I can update the doc if needed.


Hi Steve,

I think it is a bug, there shouldn't be 0 in cost column.
And no, you can't just sum all costs. What you can assume that the
final cost has the value you requested as a distance. At least not
I really have no time right now to fix this problem, but I suspect it
shouldn't be difficult to find that place where final cost is