I'm trying to get the top x unique shortest node paths. If I use a simple projection:
CALL gds.graph.project("graphSingleType", "*", {TYPE: {type: "*"}})
Yen's will return the same node path multiple times having taken different parallel edges between the nodes.
So I make a graph projection without parallel edges:
CALL gds.graph.project("graphSingleType_NP", "*", {TYPE:{type:'*', aggregation:"SINGLE"}})
The problem is that Yen's then only works when k=1 (ie when Dijkstra's is used). For all k>1, The following error is thrown:
Failed to invoke procedure `gds.shortestPath.yens.stream`: Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
I found the issue in GDS version 2.1 so I updated to 2.3 but the problem is still there.
Am I not understanding something or is this an actual bug? Alternatively, is there another way I can get the top x unique node paths?
To reproduce:
CREATE (a:CITY),
(b:CITY),
(c:CITY),
(d:CITY),
(e:CITY),
(f:CITY),
(a)-[:ROAD]->(b),
(a)-[:ROAD]->(b),
(b)-[:ROAD]->(c),
(b)-[:ROAD]->(d),
(c)-[:ROAD]->(f),
(d)-[:ROAD]->(e),
(e)-[:ROAD]->(c),
(e)-[:ROAD]->(f),
(a)-[:PATH]->(b),
(d)-[:PATH]->(e),
(d)-[:PATH]->(e)
MATCH (source), (target) WHERE id(source)=0 AND id(target)=5
CALL gds.shortestPath.yens.stream("graphSingleType_NP",
{sourceNode:source,
targetNode:target,
k:3})