mirror of https://gitee.com/bigwinds/arangodb
47 lines
92 KiB
JSON
47 lines
92 KiB
JSON
{
|
|
"basePath": "/",
|
|
"swaggerVersion": "1.1",
|
|
"apiVersion": "0.1",
|
|
"apis": [
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "If the traversal is fully executed <em>HTTP 200</em> will be returned. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "If the traversal specification is either missing or malformed, the server will respond with <em>HTTP 400</em>. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "The server will responded with <em>HTTP 404</em> if the specified edge collection does not exist, or the specified start vertex cannot be found. <br><br>",
|
|
"code": "404"
|
|
},
|
|
{
|
|
"reason": "The server will responded with <em>HTTP 500</em> when an error occurs inside the traversal or if a traversal performs more than <em>maxIterations</em> iterations. <br><br> <em>Examples</em> <br><br> In the following examples the underlying graph will contain five persons <em>Alice</em>, <em>Bob</em>, <em>Charlie</em>, <em>Dave</em> and <em>Eve</em>. We will have the following directed relations: - <em>Alice</em> knows <em>Bob</em> - <em>Bob</em> knows <em>Charlie</em> - <em>Bob</em> knows <em>Dave</em> - <em>Eve</em> knows <em>Alice</em> - <em>Eve</em> knows <em>Bob</em> <br><br> The starting vertex will always be Alice. <br><br> Follow only outbound edges: <br><br>",
|
|
"code": "500"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": "true",
|
|
"name": "body",
|
|
"description": "<br><br>"
|
|
}
|
|
],
|
|
"notes": "Starts a traversal starting from a given vertex and following. edges contained in a given edgeCollection. The request must contain the following attributes. <br><br> <ul class=\"swagger-list\"><li><em>startVertex</em>: id of the startVertex, e.g. <em>\"users/foo\"</em>. <li><em>edgeCollection</em>: (optional) name of the collection that contains the edges. <li><em>graphName</em>: (optional) name of the graph that contains the edges. Either <em>edgeCollection</em> or <em>graphName</em> has to be given. In case both values are set the <em>graphName</em> is prefered. <li><em>filter</em> (optional, default is to include all nodes): body (JavaScript code) of custom filter function function signature: (config, vertex, path) -> mixed can return four different string values: - <em>\"exclude\"</em> -> this vertex will not be visited. - <em>\"prune\"</em> -> the edges of this vertex will not be followed. - <em>\"\"</em> or <em>undefined</em> -> visit the vertex and follow it's edges. - <em>Array</em> -> containing any combination of the above. If there is at least one <em>\"exclude\"</em> or <em>\"prune\"</em> respectivly is contained, it's effect will occur. <li><em>minDepth</em> (optional, ANDed with any existing filters): visits only nodes in at least the given depth <li><em>maxDepth</em> (optional, ANDed with any existing filters): visits only nodes in at most the given depth <li><em>visitor</em> (optional): body (JavaScript) code of custom visitor function function signature: (config, result, vertex, path) -> void visitor function can do anything, but its return value is ignored. To populate a result, use the <em>result</em> variable by reference <li><em>direction</em> (optional): direction for traversal - <em>if set</em>, must be either <em>\"outbound\"</em>, <em>\"inbound\"</em>, or <em>\"any\"</em> - <em>if not set</em>, the <em>expander</em> attribute must be specified <li><em>init</em> (optional): body (JavaScript) code of custom result initialisation function function signature: (config, result) -> void initialise any values in result with what is required <li><em>expander</em> (optional): body (JavaScript) code of custom expander function <em>must</em> be set if <em>direction</em> attribute is <em>not</em> set function signature: (config, vertex, path) -> array expander must return an array of the connections for <em>vertex</em> each connection is an object with the attributes <em>edge</em> and <em>vertex</em> <li><em>sort</em> (optional): body (JavaScript) code of a custom comparison function for the edges. The signature of this function is (l, r) -> integer (where l and r are edges) and must return -1 if l is smaller than, +1 if l is greater than, and 0 if l and r are equal. The reason for this is the following: The order of edges returned for a certain vertex is undefined. This is because there is no natural order of edges for a vertex with multiple connected edges. To explicitly define the order in which edges on the vertex are followed, you can specify an edge comparator function with this attribute. Note that the value here has to be a string to conform to the JSON standard, which in turn is parsed as function body on the server side. Furthermore note that this attribute is only used for the standard expanders. If you use your custom expander you have to do the sorting yourself within the expander code. <li><em>strategy</em> (optional): traversal strategy can be <em>\"depthfirst\"</em> or <em>\"breadthfirst\"</em> <li><em>order</em> (optional): traversal order can be <em>\"preorder\"</em> or <em>\"postorder\"</em> <li><em>itemOrder</em> (optional): item iteration order can be <em>\"forward\"</em> or <em>\"backward\"</em> <li><em>uniqueness</em> (optional): specifies uniqueness for vertices and edges visited if set, must be an object like this: <em>\"uniqueness\": {\"vertices\": \"none\"|\"global\"|path\", \"edges\": \"none\"|\"global\"|\"path\"}</em> <li><em>maxIterations</em> (optional): Maximum number of iterations in each traversal. This number can be set to prevent endless loops in traversal of cyclic graphs. When a traversal performs as many iterations as the <em>maxIterations</em> value, the traversal will abort with an error. If <em>maxIterations</em> is not set, a server-defined value may be used. </ul> If the Traversal is successfully executed <em>HTTP 200</em> will be returned. Additionally the <em>result</em> object will be returned by the traversal. <br><br> For successful traversals, the returned JSON object has the following properties: <br><br> <ul class=\"swagger-list\"><li><em>error</em>: boolean flag to indicate if an error occurred (<em>false</em> in this case) <li><em>code</em>: the HTTP status code <li><em>result</em>: the return value of the traversal </ul> If the traversal specification is either missing or malformed, the server will respond with <em>HTTP 400</em>. <br><br> The body of the response will then contain a JSON object with additional error details. The object has the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>error</em>: boolean flag to indicate that an error occurred (<em>true</em> in this case) <li><em>code</em>: the HTTP status code <li><em>errorNum</em>: the server error number <li><em>errorMessage</em>: a descriptive error message",
|
|
"summary": "executes a traversal",
|
|
"httpMethod": "POST",
|
|
"examples": "<br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1242501737\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1242698345\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1242960489\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1243157097\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1242501737\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1243615849\", \n \"_key\" : \"1243615849\", \n \"_rev\" : \"1243615849\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1242501737\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1242698345\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1243615849\", \n \"_key\" : \"1243615849\", \n \"_rev\" : \"1243615849\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1243812457\", \n \"_key\" : \"1243812457\", \n \"_rev\" : \"1243812457\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1242501737\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1242698345\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1242960489\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1243615849\", \n \"_key\" : \"1243615849\", \n \"_rev\" : \"1243615849\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1244009065\", \n \"_key\" : \"1244009065\", \n \"_rev\" : \"1244009065\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1242501737\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1242698345\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1243157097\", \n \"name\" : \"Dave\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Follow only inbound edges: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"inbound\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1247154793\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1248006761\", \n \"name\" : \"Eve\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1247154793\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1248858729\", \n \"_key\" : \"1248858729\", \n \"_rev\" : \"1248858729\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1247154793\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1248006761\", \n \"name\" : \"Eve\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Follow any direction of edges: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1252201065\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1251545705\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1251807849\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1252004457\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253053033\", \n \"_key\" : \"1253053033\", \n \"_rev\" : \"1253053033\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1252201065\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253053033\", \n \"_key\" : \"1253053033\", \n \"_rev\" : \"1253053033\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1253249641\", \n \"_key\" : \"1253249641\", \n \"_rev\" : \"1253249641\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1252201065\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1251545705\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253053033\", \n \"_key\" : \"1253053033\", \n \"_rev\" : \"1253053033\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1253249641\", \n \"_key\" : \"1253249641\", \n \"_rev\" : \"1253249641\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1252463209\", \n \"_key\" : \"1252463209\", \n \"_rev\" : \"1252463209\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1252201065\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1251545705\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253053033\", \n \"_key\" : \"1253053033\", \n \"_rev\" : \"1253053033\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1253249641\", \n \"_key\" : \"1253249641\", \n \"_rev\" : \"1253249641\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1252659817\", \n \"_key\" : \"1252659817\", \n \"_rev\" : \"1252659817\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1252201065\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1251545705\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1251807849\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253053033\", \n \"_key\" : \"1253053033\", \n \"_rev\" : \"1253053033\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1253249641\", \n \"_key\" : \"1253249641\", \n \"_rev\" : \"1253249641\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1252856425\", \n \"_key\" : \"1252856425\", \n \"_rev\" : \"1252856425\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1251349097\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1252201065\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1251545705\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1252004457\", \n \"name\" : \"Dave\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Excluding <em>Charlie</em> and <em>Bob</em>: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\" || vertex.name === \\\"Charlie\\\") {return \\\"exclude\\\";}return;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256526441\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1257181801\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256526441\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1257640553\", \n \"_key\" : \"1257640553\", \n \"_rev\" : \"1257640553\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1258033769\", \n \"_key\" : \"1258033769\", \n \"_rev\" : \"1258033769\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256526441\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1256723049\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1257181801\", \n \"name\" : \"Dave\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Do not follow edges from <em>Bob</em>: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\") {return \\\"prune\\\";}return;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260982889\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1261179497\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260982889\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1262097001\", \n \"_key\" : \"1262097001\", \n \"_rev\" : \"1262097001\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260982889\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1261179497\", \n \"name\" : \"Bob\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Visit only nodes in a depth of at least 2: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"minDepth\" : 2}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1265570409\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1265767017\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1266225769\", \n \"_key\" : \"1266225769\", \n \"_rev\" : \"1266225769\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1266422377\", \n \"_key\" : \"1266422377\", \n \"_rev\" : \"1266422377\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1265111657\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1265308265\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1265570409\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1266225769\", \n \"_key\" : \"1266225769\", \n \"_rev\" : \"1266225769\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1266618985\", \n \"_key\" : \"1266618985\", \n \"_rev\" : \"1266618985\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1265111657\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1265308265\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1265767017\", \n \"name\" : \"Dave\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Visit only nodes in a depth of at most 1: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"maxDepth\" : 1}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1269764713\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1269961321\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1269764713\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1270878825\", \n \"_key\" : \"1270878825\", \n \"_rev\" : \"1270878825\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1269764713\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1269961321\", \n \"name\" : \"Bob\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Count all visited nodes and return a list of nodes only: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"init\" : \"result.visited = 0; result.myVertices = [ ];\", \"visitor\" : \"result.visited++; result.myVertices.push(vertex);\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : 4, \n \"myVertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1273893481\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1274090089\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1274352233\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1274548841\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Expand only inbound edges of <em>Alice</em> and outbound edges of <em>Eve</em>: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"expander\":\"var connections = [ ];if (vertex.name === \\\"Alice\\\") {config.datasource.getInEdges(vertex).forEach(function (e) {connections.push({ vertex: require(\\\"internal\\\").db._document(e._from), edge: e});});}if (vertex.name === \\\"Eve\\\") {config.datasource.getOutEdges(vertex).forEach(function (e) {connections.push({vertex: require(\\\"internal\\\").db._document(e._to), edge: e});});}return connections;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1278349929\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1279201897\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1278546537\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1278349929\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1280053865\", \n \"_key\" : \"1280053865\", \n \"_rev\" : \"1280053865\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1278349929\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1279201897\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1280053865\", \n \"_key\" : \"1280053865\", \n \"_rev\" : \"1280053865\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1280250473\", \n \"_key\" : \"1280250473\", \n \"_rev\" : \"1280250473\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1278349929\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1279201897\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1278546537\", \n \"name\" : \"Bob\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Follow the <em>depthfirst</em> strategy: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"strategy\":\"depthfirst\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1283789417\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1283986025\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1283789417\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1283986025\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1285034601\", \n \"_key\" : \"1285034601\", \n \"_rev\" : \"1285034601\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1285034601\", \n \"_key\" : \"1285034601\", \n \"_rev\" : \"1285034601\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1285231209\", \n \"_key\" : \"1285231209\", \n \"_rev\" : \"1285231209\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1285034601\", \n \"_key\" : \"1285034601\", \n \"_rev\" : \"1285034601\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1285231209\", \n \"_key\" : \"1285231209\", \n \"_rev\" : \"1285231209\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1284444777\", \n \"_key\" : \"1284444777\", \n \"_rev\" : \"1284444777\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1285034601\", \n \"_key\" : \"1285034601\", \n \"_rev\" : \"1285034601\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1285231209\", \n \"_key\" : \"1285231209\", \n \"_rev\" : \"1285231209\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1284641385\", \n \"_key\" : \"1284641385\", \n \"_rev\" : \"1284641385\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1283789417\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1285034601\", \n \"_key\" : \"1285034601\", \n \"_rev\" : \"1285034601\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1285231209\", \n \"_key\" : \"1285231209\", \n \"_rev\" : \"1285231209\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1284837993\", \n \"_key\" : \"1284837993\", \n \"_rev\" : \"1284837993\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1283986025\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1284444777\", \n \"_key\" : \"1284444777\", \n \"_rev\" : \"1284444777\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1284444777\", \n \"_key\" : \"1284444777\", \n \"_rev\" : \"1284444777\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1285231209\", \n \"_key\" : \"1285231209\", \n \"_rev\" : \"1285231209\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1284444777\", \n \"_key\" : \"1284444777\", \n \"_rev\" : \"1284444777\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1285231209\", \n \"_key\" : \"1285231209\", \n \"_rev\" : \"1285231209\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1285034601\", \n \"_key\" : \"1285034601\", \n \"_rev\" : \"1285034601\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1284182633\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1284444777\", \n \"_key\" : \"1284444777\", \n \"_rev\" : \"1284444777\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1284641385\", \n \"_key\" : \"1284641385\", \n \"_rev\" : \"1284641385\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1283789417\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1284444777\", \n \"_key\" : \"1284444777\", \n \"_rev\" : \"1284444777\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1284837993\", \n \"_key\" : \"1284837993\", \n \"_rev\" : \"1284837993\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1283330665\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283527273\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1283986025\", \n \"name\" : \"Dave\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Using <em>postorder</em> ordering: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"order\":\"postorder\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1289949801\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1290146409\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1289949801\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1290146409\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1291194985\", \n \"_key\" : \"1291194985\", \n \"_rev\" : \"1291194985\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1291391593\", \n \"_key\" : \"1291391593\", \n \"_rev\" : \"1291391593\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1290605161\", \n \"_key\" : \"1290605161\", \n \"_rev\" : \"1290605161\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1291194985\", \n \"_key\" : \"1291194985\", \n \"_rev\" : \"1291194985\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1291391593\", \n \"_key\" : \"1291391593\", \n \"_rev\" : \"1291391593\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1290801769\", \n \"_key\" : \"1290801769\", \n \"_rev\" : \"1290801769\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1289949801\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1291194985\", \n \"_key\" : \"1291194985\", \n \"_rev\" : \"1291194985\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1291391593\", \n \"_key\" : \"1291391593\", \n \"_rev\" : \"1291391593\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1290998377\", \n \"_key\" : \"1290998377\", \n \"_rev\" : \"1290998377\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1290146409\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1291194985\", \n \"_key\" : \"1291194985\", \n \"_rev\" : \"1291194985\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1291391593\", \n \"_key\" : \"1291391593\", \n \"_rev\" : \"1291391593\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1291194985\", \n \"_key\" : \"1291194985\", \n \"_rev\" : \"1291194985\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1290605161\", \n \"_key\" : \"1290605161\", \n \"_rev\" : \"1290605161\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1291391593\", \n \"_key\" : \"1291391593\", \n \"_rev\" : \"1291391593\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1291194985\", \n \"_key\" : \"1291194985\", \n \"_rev\" : \"1291194985\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1290605161\", \n \"_key\" : \"1290605161\", \n \"_rev\" : \"1290605161\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1291391593\", \n \"_key\" : \"1291391593\", \n \"_rev\" : \"1291391593\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1290343017\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1290605161\", \n \"_key\" : \"1290605161\", \n \"_rev\" : \"1290605161\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1290801769\", \n \"_key\" : \"1290801769\", \n \"_rev\" : \"1290801769\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1289949801\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1290605161\", \n \"_key\" : \"1290605161\", \n \"_rev\" : \"1290605161\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1290998377\", \n \"_key\" : \"1290998377\", \n \"_rev\" : \"1290998377\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1290146409\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1290605161\", \n \"_key\" : \"1290605161\", \n \"_rev\" : \"1290605161\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1289687657\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1289491049\", \n \"name\" : \"Alice\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Using <em>backward</em> item-ordering: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"itemOrder\":\"backward\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1296306793\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1296110185\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1296306793\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1296110185\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1296765545\", \n \"_key\" : \"1296765545\", \n \"_rev\" : \"1296765545\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1296765545\", \n \"_key\" : \"1296765545\", \n \"_rev\" : \"1296765545\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1297158761\", \n \"_key\" : \"1297158761\", \n \"_rev\" : \"1297158761\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1296306793\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1296765545\", \n \"_key\" : \"1296765545\", \n \"_rev\" : \"1296765545\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1296962153\", \n \"_key\" : \"1296962153\", \n \"_rev\" : \"1296962153\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1296110185\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1296765545\", \n \"_key\" : \"1296765545\", \n \"_rev\" : \"1296765545\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1297551977\", \n \"_key\" : \"1297551977\", \n \"_rev\" : \"1297551977\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1296765545\", \n \"_key\" : \"1296765545\", \n \"_rev\" : \"1296765545\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1297551977\", \n \"_key\" : \"1297551977\", \n \"_rev\" : \"1297551977\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1297355369\", \n \"_key\" : \"1297355369\", \n \"_rev\" : \"1297355369\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1297355369\", \n \"_key\" : \"1297355369\", \n \"_rev\" : \"1297355369\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1297355369\", \n \"_key\" : \"1297355369\", \n \"_rev\" : \"1297355369\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1297551977\", \n \"_key\" : \"1297551977\", \n \"_rev\" : \"1297551977\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1297355369\", \n \"_key\" : \"1297355369\", \n \"_rev\" : \"1297355369\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1297551977\", \n \"_key\" : \"1297551977\", \n \"_rev\" : \"1297551977\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1297158761\", \n \"_key\" : \"1297158761\", \n \"_rev\" : \"1297158761\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1296306793\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1297355369\", \n \"_key\" : \"1297355369\", \n \"_rev\" : \"1297355369\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1297551977\", \n \"_key\" : \"1297551977\", \n \"_rev\" : \"1297551977\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1296962153\", \n \"_key\" : \"1296962153\", \n \"_rev\" : \"1296962153\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1296110185\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1297355369\", \n \"_key\" : \"1297355369\", \n \"_rev\" : \"1297355369\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1297551977\", \n \"_key\" : \"1297551977\", \n \"_rev\" : \"1297551977\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1296765545\", \n \"_key\" : \"1296765545\", \n \"_rev\" : \"1296765545\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1296503401\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1295848041\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1295651433\", \n \"name\" : \"Alice\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Edges should only be included once globally, but nodes are included every time they are visited: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"visited\" : { \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1302663785\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1302008425\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1302270569\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1302467177\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1303515753\", \n \"_key\" : \"1303515753\", \n \"_rev\" : \"1303515753\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1302663785\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1303515753\", \n \"_key\" : \"1303515753\", \n \"_rev\" : \"1303515753\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1303712361\", \n \"_key\" : \"1303712361\", \n \"_rev\" : \"1303712361\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1302663785\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1302008425\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1303515753\", \n \"_key\" : \"1303515753\", \n \"_rev\" : \"1303515753\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1303712361\", \n \"_key\" : \"1303712361\", \n \"_rev\" : \"1303712361\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1302925929\", \n \"_key\" : \"1302925929\", \n \"_rev\" : \"1302925929\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1302663785\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1302008425\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1303515753\", \n \"_key\" : \"1303515753\", \n \"_rev\" : \"1303515753\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1303712361\", \n \"_key\" : \"1303712361\", \n \"_rev\" : \"1303712361\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1303122537\", \n \"_key\" : \"1303122537\", \n \"_rev\" : \"1303122537\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1302663785\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1302008425\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1302270569\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1303515753\", \n \"_key\" : \"1303515753\", \n \"_rev\" : \"1303515753\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1303712361\", \n \"_key\" : \"1303712361\", \n \"_rev\" : \"1303712361\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1303319145\", \n \"_key\" : \"1303319145\", \n \"_rev\" : \"1303319145\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1301811817\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1302663785\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1302008425\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1302467177\", \n \"name\" : \"Dave\" \n } \n ] \n } \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> If the underlying graph is cyclic, <em>maxIterations</em> should be set: <br><br> The underlying graph has two vertices <em>Alice</em> and <em>Bob</em>. With the directed edges: <ul class=\"swagger-list\"><li><em>Alice</em> knows <em>Bob</em> </ul> _ <em>Bob</em> knows <em>Alice</em> <br><br> <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"none\"},\"maxIterations\":5}\n\nHTTP/1.1 500 Internal Error\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 500, \n \"errorNum\" : 1909, \n \"errorMessage\" : \"too many iterations\" \n}\n</code></pre><br><br><br> <br><br>",
|
|
"nickname": "executesATraversal"
|
|
}
|
|
],
|
|
"path": "/_api/traversal"
|
|
}
|
|
]
|
|
}
|