arangodb traverse tree including edges

z999

Using 'GRAPH_TRAVERSAL_TREE' in my AQL only returns the vertices, is there away of returning the edge documents together with the vertices. Example:

FOR item in GRAPH_TRAVERSAL_TREE('graph','_id','outbound','items')
  Return item

Returns something like:

[
  {vertex},
  items:[
   {vertex, items:[]},
   {vertex, items:[]},
  ]
]

I would like the edge information to be included in the result as below

[
  {vertex},
  items:[
   {edge:{edge}, vertex:{vertex}, items:[]},
   {edge:{edge}, vertex:{vertex}, items:[]},
  ]
]

Using AQL without graph functions I have this:

for item in items filter item._id == 'items/212612934312'
  return {'head': item, 'items': [(
    for edge in itemEdges filter edge._from == item._id
      for vertex in items filter vertex._id == edge._to
        return {'edge': edge, 'vertex': vertex}
)]}

But I am sure there should be a better way?

florian

This is currently not supported , if you need that you have to raise a change request. An alternative might be to use GRAPH_SHORTEST_PATH but i am not 100% if this fits for your use case:

GRAPH_SHORTEST_PATH("graph", '_id', {}, {direction : "outbound"})

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related