Hi Marko,

there is no direct substitute for this function, but you can use native AQL 
traversal <https://docs.arangodb.com/3.0/AQL/Graphs/index.html> to return 
something similar:

FOR v, e, p IN 1..5 ANY "company/9" careerEdges
    LET other = (
        FOR vv, ee IN ANY v careerEdges
            FILTER ee != e
            LIMIT 1
            RETURN 1
    )
    FILTER LENGTH(other) == 0 || LENGTH(p.edges) == 5
    RETURN p

A traversal is started at vertex company/9 with a minimum depth = 1 and 
maximum depth = 5, following edges in careerEdges collection while ignoring 
their direction.

You could immediately RETURN p to get the full traversal paths, but it 
would include e.g. A-B as well as A-B-C and A-B-C-D, so not just the 
"longest" paths.
Therefore, a second traversal with depth = 1 is started to check if we 
reached a leaf node (= no more incoming or outgoing 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, e.g. because the max depth is exceeded. 
Thus, we need to also let paths through, which contain as many edges as 
hops we do in the traversal (here: 5).

Excerpt of a possible result to illustrate the data structure returned:

[
  {
    "vertices": [
      {
        "_id": "company/9",
        "_rev": "14256942884",
        "_key": "9"
      },
      {
        "_id": "company/3",
        "_rev": "14243770148",
        "_key": "3"
      },
      {
        "_id": "company/7",
        "_rev": "14256680740",
        "_key": "7"
      },
      {
        "_id": "company/8",
        "_rev": "14256811812",
        "_key": "8"
      }
    ],
    "edges": [
      {
        "order": 2,
        "beginAt": "2010-02-10T16:53:32.898Z",
        "_id": "careerEdges/266196397352",
        "_rev": "14725456474",
        "_key": "266196397352",
        "_from": "company/9",
        "_to": "company/3"
      },
      {
        "order": 2,
        "_id": "careerEdges/266196397818",
        "_rev": "14726505050",
        "_key": "266196397818",
        "_from": "company/3",
        "_to": "company/7"
      },
      {
        "order": 2,
        "_id": "careerEdges/266196397834",
        "_rev": "14725980762",
        "_key": "266196397834",
        "_from": "company/7",
        "_to": "company/8"
      }
    ]
  },
  {
    "vertices": [
      {
        ...

It does not return a tree-like structure, but it could be constructed on 
client-side if really needed - all the required information is there, even 
including the edge documents:

result[n].vertices[0] -- result[n].edge[0] -- result[n].vertices[1]
and so on

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to