Traversals

    Also Traversals have been added to AQL.Please read the chapter about AQL traversersals before you continue reading here.Most of the traversal cases are covered by AQL and will be executed in an optimized way.Only if the logic for your is too complex to be defined using AQL filters you can use the traversal object definedhere which gives you complete programmatic access to the data.

    For any of the following examples, we’ll be using the example collections v and e,populated with continents, countries and capitals data listed below (see ).

    For example, to determine which edges are linked to the world vertex, we can use inEdges:

    inEdges will give us all ingoing edges for the specified vertex v/world. The resultis a JavaScript array that we can iterate over and print the results:

    We are using the document method from the db object to retrieve the connected vertices now.

    While this may be sufficient for one-level graph operations, writing a traversal by handmay become too complex for multi-level traversals.