I need to find shortest paths which should pass through several nodes and edges. Few details:
Is there any way to find paths like this using arangodb? I've tried K_SHORTEST_PATHS but it is too slow for some cases.
Without a data set, this is tricky to test. Unfortunately, K_SHORTEST_PATHS
is the only built-in way to add "weight" to edges, unless you build something yourself. Also, both SHORTEST_PATH
methods do not implement PRUNE
, which is the best way to speed graph traversal.
My suggestion would be to use a directed graph method ( FOR v,e,p IN 1..9 INBOUND x...
), implementing both PRUNE
and FILTER
clauses to reduce the number of hops, and something like COLLECT path = p AGGREGATE weight = SUM(e.weight)
to calculate weight.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.