I have implemented the pgrouting Dijkstra one-to-many algorithm, and have noticed that the result is a table of every route together, with and
edge value of
-1 indicating the end of an individual route.
I am interested in selecting the cheapest route of all the routing results. By manually parsing and comparing the results via the
agg_cost values, I have found that every single time, the first group of results (i.e. the rows up until the first
-1 value is the) is the shortest path.
I'm wondering now if this is by design, if it is a consequence of Dijkstra's algorithm (or at least this implementation of it), or if it is just a coincidence given my relatively simply sample dataset.
Is it necessary to manually compare the routing results to find the shortest path, or will the first route in the group always be the shortest one?