Forum #18 - Topic #65 - Message List
Hi pgRouting user and developper.
I`m new in pgRouting, but I think I found an error with shortest_path and shortest_path_astar. I get a path, which is not the shortest, when i have two edges which have the same endpoints, different costs and the id of the longer path is lower than the one of the shorter path.
Following example shows the problem:
select * from shortest_path(' select 1 as id, 11 as source, 12 as target, 2::float8 as cost union select 2 as id, 11 as source, 12 as target, 1::float8 as cost ', 11, 12, false, false)
Edge 1 and 2 start at 11 and end at 12. Edge 1 is longer (more costs) then edge 2 - but the result is:
11;1;2 12;-1;0
When I give shorter edge the lower id, the result is correct:
select * from shortest_path(' select 1 as id, 11 as source, 12 as target, 1::float8 as cost union select 2 as id, 11 as source, 12 as target, 2::float8 as cost ', 11, 12, false, false)
-> 11;1;1 12;-1;0
I only tried shortest_path - not astar with this simple example, but with a complex net there were the same problems. In a real road-network this situation is not seldom.
If there is no other solution, I have to remove the longer edges from my network, but this would not speed up my application ;-) .
I use the 1.0a Version, because its the only one with windows installer up to now. Maybe it is a known bug, maybe it is fixed in newer versions - I found no info about this.
If it is fixed or if it can be fixed soon - can somebody tell me, when the next compiled pgRouting - Version for windows will be avalable - in one month or in one year?
Thanks
Thomas
-
Message #237
Hi,
Vertex-based algorithms (Dijkstra and A*) don't process parallel edges correctly. If your graph contain such edges it is better to split them or to use Shooting* algorithm.
anton11/16/07 10:12:03 -
Message #241
Hallo Anton,
Thanks for reply!
ok - so it is a known problem / behavior.
The shooting* should work - so I will try.
Or I will update edges - table and give the sortest path the lowest id. The idea of splitting them is a good idea too.
By the way I want to mention, that pgRouting is a great extension for postres and very helpfull.
Thanks
Thomas
thomas11/16/07 19:32:16

