5

What is the purpose of a graph that is "undirected, with cost and reverse cost"? Where is the difference to a graph that is "undirected, with cost" ?

For me it does not really make sense, because for my understanding the reverse cost should just come into play when the graph is directed ... (Figure from http://docs.pgrouting.org/dev/doc/src/developer/sampledata.html#fig2) graph that is undirected, with cost and reverse cost

2 Answers 2

4

Maybe the documentation at http://docs.pgrouting.org/dev/src/dijkstra/doc/index.html#pgr-dijkstra can shed some light onto the isse. It would seem like - in an undirected graph - one can go in either direction with either cost or reverse_cost:

enter image description here

Not sure which real-world application this is used for though.

1
  • 1
    Not tried this myself, but this answer suggests a couple of practical applications for this and gives an example.
    – Steven Kay
    Dec 8, 2015 at 23:48
3

The reason why you can set undirected graph with reverse_cost has a simple reason: the function has two arguments, one for directed true/false and one for reverse_cost true/false. But you're right that it only makes sense for a directed graph. In the other case it will be ignored.

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.