I want to find a shortest path in neo4j between a start and end node. The graph is weighted with properties “costs” and “transit_time”.
I wanna find the shortest path in terms of transit_time. However, for this I only want each relationship to have costs below 1000. Requirement is, I cannot use GDS. In fact, I cannot use anything that creates a sub-graph (so apoc subgraph is also not an option). I tried this with APOC
MATCH (start:Node {id: 'startId'}), (end:Node {id: 'endId'})
CALL apoc.algo.dijkstra(start, end, 'REL1|REL2', 'transit_time') YIELD path, weight
WHERE all(r in relationships(path) WHERE r.costs < 1000)
RETURN path, weight
However, if the shortest path found does not match WHERE criteria, I get nothing. How can I tell Dijkstra function to only consider specific relationships that match the condition?
I found this discussion on GitHub: https://github.com/neo4j/apoc/issues/136
However, seems like there was no solution for that within APOC (as of Sep 2022). So I continue looking for a workaround.
Kind regards and thanks for your help!