Closed Heermosi closed 5 years ago
1) Have you tried to use a >
or <
in the relationship specification, e.g.
call apoc.algo.dijkstra(startNode, endNode, 'DELAYS>', 'time') yield path, weight
?
This should only consider paths like (startNode)-[:DELAYS*]->(endNode)
and disregard inbound DELAYS
relationships.
2) apoc.algo.dijkstra(startNode, endNode, 'KNOWS|<WORKS_WITH|IS_MANAGER_OF>', 'distance', defaultValue, numberOfWantedResults) yield path, weight
see the optional last parameter numberOfWantedResults
- is this what you're looking for?
1. Have you tried to use a `>` or `<` in the relationship specification, e.g. `call apoc.algo.dijkstra(startNode, endNode, 'DELAYS>', 'time') yield path, weight` ? This should only consider paths like `(startNode)-[:DELAYS*]->(endNode)` and disregard inbound `DELAYS` relationships. 2. `apoc.algo.dijkstra(startNode, endNode, 'KNOWS|<WORKS_WITH|IS_MANAGER_OF>', 'distance', defaultValue, numberOfWantedResults) yield path, weight` see the optional last parameter `numberOfWantedResults` - is this what you're looking for?
After all, thank you for your reply. Have a nice day!
***1. When I tried to calculate the shortest path, it gives result of non-directional shortest path, while I want a directional one. I wonder how to set the parameter so that I may get a desired result?
The first is most important, I think it might be something implemented but not written in document. Thank you for your reading
with some code:
MATCH (c:Character), (d:Character) where c.nickname = 'xxxxx' and d.nickname = 'yyyyy' CALL apoc.algo.dijkstra(c, d, 'SHARE', 'iweight', 0, 99) YIELD path, weight With weight, collect(path) as ps order by weight LIMIT 1 UNWIND ps as p return nodes(p), relationships(p)
We want this [:SHARE] calculation be directional