dijkstra (#16) - "directed" and "has_reverse_cost" arguments (#156) - Message List

"directed" and "has_reverse_cost" arguments

Hello,

Suppose that we have a table prepared for pgRouting and such that:

1) reverse_cost = cost for all bi-directional edge,

2) reverse_cost = 9999 for all uni-directional edge (one-way streets).

Usually, when I use the shortest_path function with the argument "directed" set to true, I automatically set the argument "has_reverse_cost" to true.

Does it make sense to set "directed" to false (resp. true) and "has_reverse_cost" to true (resp. false)? If yes, could you give me an example?

Thanks for your help!

  • Message #544

    Hi,

    Let's start from the beginning.

    First boolean parameter tells us if the graph is directed or not. If it is false, graph is supposed to be undirected and it means that cost value will be used for both directions and second parameter makes no sense. If directed flag is on, then there are two possibilities: reverse cost value will be used for reverse direction if reverse cost flag is on, and all edges are supposed to be one way streets if reverse cost flag is off.