[pgrouting-users] Wrong edge

Simon Nuttall simon.nuttall at gmail.com
Mon Jun 7 19:40:49 EDT 2010


I've tried to make this example of how the wrong edge is chosen, as
simple as possible:

drop table if exists edge;
CREATE TABLE edge (
  id int4,
  source int4,
  target int4,
  cost float8,
  reverse_cost float8);

truncate edge;
insert into edge values ( 2, 1, 2, 2, 2);
insert into edge values ( 1, 1, 2, 1, 1);

SELECT * FROM shortest_path('SELECT * from edge', 1, 2, true, true);

# Choses the longer route:

 vertex_id | edge_id | cost
-----------+---------+------
         1 |       2 |    2
         2 |      -1 |    0
(2 rows)


If I change the order of the inserts it gets the right answer.

I think this bug is related to

http://pgrouting.postlbs.org/ticket/177

Simon


More information about the Pgrouting-users mailing list