[pgrouting-users] Different results - pgr_dijkstra/pgr_kdijkstrapath/cost/pgr_ksp

I have a city roads data base witch is returning different values from this ‘selects’.

select sum(cost) from pgr_Dijkstra(‘SELECT id, source, target, cost, reverse_cost FROM ruas’, 3423, 3839, true, true);

select sum(cost) from pgr_kdijkstraPath(‘SELECT id, source, target, cost, reverse_cost FROM ruas’, 3423, array[3839], true, true);

select sum(cost) from pgr_ksp(‘SELECT id, source, target, cost, reverse_cost FROM ruas’, 3423, 3839, 1, true);

Manually I have seen that the pgr_Dijkstra has the correct path.

And the others has passed from edges who is not the shortest path.

Is it an alghorithm error?

Omar Fernando Pessôa
http://www.opessoa.com
Desenvolvedor de sistemas
Programador C# e C++

On 3/25/2014 10:45 AM, Omar Fernando Pessôa wrote:

I have a city roads data base witch is returning different values from
this 'selects'.

    select sum(cost) from pgr_Dijkstra('SELECT id, source, target, cost,
    reverse_cost FROM ruas',3423, 3839, true, true);

    select sum(cost) from pgr_kdijkstraPath('SELECT id, source, target,
    cost, reverse_cost FROM ruas',3423, array[3839], true, true);

    select sum(cost) from pgr_ksp('SELECT id, source, target, cost,
    reverse_cost FROM ruas', 3423, 3839, 1, true);

Manually I have seen that the pgr_Dijkstra has the correct path.

And the others has passed from edges who is not the shortest path.

Is it an alghorithm error?

Omar,

It would seem that these all should return the same basic result, or at least a result where the total cost is the same in all cases.

I know there were some fixes made at some point to correct a problem of multiple parallel paths where a non-short path was getting returned. It is possible that this fix may need to be applied to these other algorithms also.

Please open a ticket and if possible add a simple example that reproduces the problem.

If you can did into the code, we would be happy to get a pull request against the "develop" branch.

Thank you,
   -Steve