I am currently working with the pgr_withPointsCost() function in order to get the shortest path costs for millions of origin-destination pairs of Points (OD-Pairs; Many-To-Many). I got the function to work but I was wondering what happens to OD-Pairs pgrouting cannot find a path for?

The documentation of the function states the following:

"When the starting vertex and ending vertex are the different and there is no path. The agg_cost in the non included values (u, v) is ∞"

From this I see that OD-Pairs with no path found (which is eg. due to network connectivity problems) are not included in the result table.

Does pgrouting feature any option to include OD-Pairs that have no shortest path between the origin and destination point (eg by including them with an agg_cost value of NULL or ∞)?

I would like to see which pairs could not be connected by a shortest path in order to identify graph connectivity issues. I already thought about getting the result by using joins on OD-id pairs and the result table but was wondering if there was any pgrouting specific solution I have overseen.

1 Answer 1


I don't think there is a setting to return routes (or lack there of) in the manor you are asking about.

Although not perfect, pgr_analyseGraph will give you a number of useful outputs in debugging network topology. I have also had success with pgr_analyzeOneway. If you set the two_way_if_null flag to false, it should identify edges where traffic can enter the edge but not exit, though you might have to play with the directions in which they are drawn.

  • Thanks for your answer, I guess it is my best start to work with pgr_analyseGraph and pgr_analyzeOneway.
    – root676
    Jul 23, 2018 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.