[pgrouting-users] server closed the connection unexpectedly with shortest_path when using directed = true

Charles Galpin wrote:

Hi Steve

On May 17, 2010, at 11:03 AM, Stephen Woodbridge wrote:

I do not think you should be passing -1 as the reverse cost, what is that supposed to mean? Edge weights should not be negative. If You are just trying to avoid it from taking a reverse edge for testing then set the value to a very large number instead.

I simply want to force the routing to not support traversing a link in reverse (in other words force the routing to follow the only real world path). My links are directed (one way).

According to the following wiki page, a negative cost prevents an edge from being inserted into the graph.

http://pgrouting.postlbs.org/wiki/Dijkstra

OK, it has been a while since I read the docs, so maybe I should go read them again :wink:

I can see having a large number working by making the cost high, but this doesn't seem right.

Typically, you should be passing the column that contains the reverse cost and not a constant. In you example above "length" is a column that contains the cost, if your cost and reverse cost are the same and you just want to test a bidirectional graph then you could set you reverse cost to "length" also, like:

SELECT gid AS id, source::integer,target::integer, length::double
precision AS cost, length::double precision as reverse_cost FROM links

Doesn't this just say my links are bidirectional and the cost is the same?

Yes

This is exactly what I don't want :slight_smile:

Thanks,
charles