You can do a second traversal with depth = 1 to check if you reached a leaf 
node (no more incoming edges).
Based on this information, the “short” paths can be filtered out.

Note that a second condition is required:
it is possible that the last node in a traversal is not a leaf node if the 
maximum traversal depth is exceeded.
Thus, you need to also let paths through, which contain as many edges as 
hops you do in the traversal.

LET maxDepth = 5
FOR v, e, p IN 1..maxDepth OUTBOUND "verts/s" edges
  LET next = (
    FOR vv, ee IN OUTBOUND v edges
      //FILTER ee != e // needed if traversing edges in ANY direction
      LIMIT 1 // optimization, no need to check for more than a single 
neighbor
      RETURN true // using a constant here, which is not actually used
  )
  FILTER LENGTH(next) == 0 || LENGTH(p.edges) == maxDepth
  RETURN CONCAT_SEPARATOR(" <- ", p.vertices[*]._key)

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/arangodb/3c47c49e-3673-42e1-9fe8-ac16d71cf351%40googlegroups.com.

Reply via email to