-
-
Notifications
You must be signed in to change notification settings - Fork 383
Description
Problem
TL;DR: pgr_KSP function ignores options where vertex collection is the same as another better result. If you can get from point A to point B, traversing exactly the same nodes as another solution, this solution is not considered
To Reproduce
Create a topology, in this example we have already created our tables "noded" and "noded_vertices_pgr" using pgr_nodeNetwork and pgr_createTopology

Then after apply pgr_KSP, only show as possible options edge 7, and edge 9+10.
Edge 8 is missing due to have the same vertex collection as edge 7 (vertex 7 and vertex 8, but through edge 8 instead of edge 7). If edge 8 is split (same as example edge 9+10), then it works and returns 3 path results, just because vertex collection for this result would be different
SQL from node 7 to node 8, we allow reverse as well, and limit to 3 paths, but only 2 will return:
SELECT *
FROM pgr_KSP(
'SELECT id, source, target, ST_Length(wkb_geometry::geography) as cost, ST_Length(wkb_geometry::geography) as reverse_cost
FROM mytable_noded',
7,
8,
3) as ksp
Expectation
Get all shortest paths, even if the vertex combination already exists as result, but have a different edges collection. This includes third path, using nodes 7,8 with edge 8 (almost like the first one, but using edge 8 creating a new path_id=3)
Platform/versions
PostgreSQL="14.11"
POSTGIS="3.4.2 c19ce56"
pgr_version="3.6.2"
