简体   繁体   中英

Find shortest paths through predefined set of vertices and edges in arangodb

I need to find shortest paths which should pass through several nodes and edges. Few details:

  1. It should be shortest paths according to weights.
  2. Include set can be ordered and unordered.
  3. Graph size - 50 000 vertices and 450 0000 edges

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM