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\" : \"1197866152\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1198062760\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1198324904\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1198521512\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1197866152\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1198980264\", \n \"_key\" : \"1198980264\", \n \"_rev\" : \"1198980264\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1197866152\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1198062760\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1198980264\", \n \"_key\" : \"1198980264\", \n \"_rev\" : \"1198980264\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1199176872\", \n \"_key\" : \"1199176872\", \n \"_rev\" : \"1199176872\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1197866152\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1198062760\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1198324904\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1198980264\", \n \"_key\" : \"1198980264\", \n \"_rev\" : \"1198980264\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1199373480\", \n \"_key\" : \"1199373480\", \n \"_rev\" : \"1199373480\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1197866152\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1198062760\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1198521512\", \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\" : \"1202322600\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1203174568\", \n \"name\" : \"Eve\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1202322600\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1204026536\", \n \"_key\" : \"1204026536\", \n \"_rev\" : \"1204026536\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1202322600\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1203174568\", \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\" : \"1206516904\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1207368872\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1206713512\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1206975656\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1207172264\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1208220840\", \n \"_key\" : \"1208220840\", \n \"_rev\" : \"1208220840\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1207368872\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1208220840\", \n \"_key\" : \"1208220840\", \n \"_rev\" : \"1208220840\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1208417448\", \n \"_key\" : \"1208417448\", \n \"_rev\" : \"1208417448\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1207368872\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1206713512\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1208220840\", \n \"_key\" : \"1208220840\", \n \"_rev\" : \"1208220840\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1208417448\", \n \"_key\" : \"1208417448\", \n \"_rev\" : \"1208417448\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1207631016\", \n \"_key\" : \"1207631016\", \n \"_rev\" : \"1207631016\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1207368872\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1206713512\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1208220840\", \n \"_key\" : \"1208220840\", \n \"_rev\" : \"1208220840\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1208417448\", \n \"_key\" : \"1208417448\", \n \"_rev\" : \"1208417448\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1207827624\", \n \"_key\" : \"1207827624\", \n \"_rev\" : \"1207827624\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1207368872\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1206713512\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1206975656\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1208220840\", \n \"_key\" : \"1208220840\", \n \"_rev\" : \"1208220840\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1208417448\", \n \"_key\" : \"1208417448\", \n \"_rev\" : \"1208417448\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1208024232\", \n \"_key\" : \"1208024232\", \n \"_rev\" : \"1208024232\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1206516904\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1207368872\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1206713512\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1207172264\", \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\" : \"1211694248\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1212349608\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1211694248\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1212808360\", \n \"_key\" : \"1212808360\", \n \"_rev\" : \"1212808360\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1213201576\", \n \"_key\" : \"1213201576\", \n \"_rev\" : \"1213201576\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1211694248\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1211890856\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1212349608\", \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\" : \"1216150696\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1216347304\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1216150696\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1217264808\", \n \"_key\" : \"1217264808\", \n \"_rev\" : \"1217264808\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1216150696\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1216347304\", \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\" : \"1220934824\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1221131432\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1221590184\", \n \"_key\" : \"1221590184\", \n \"_rev\" : \"1221590184\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1221786792\", \n \"_key\" : \"1221786792\", \n \"_rev\" : \"1221786792\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1220476072\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1220672680\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1220934824\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1221590184\", \n \"_key\" : \"1221590184\", \n \"_rev\" : \"1221590184\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1221983400\", \n \"_key\" : \"1221983400\", \n \"_rev\" : \"1221983400\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1220476072\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1220672680\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1221131432\", \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\" : \"1224932520\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1225129128\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1224932520\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1226046632\", \n \"_key\" : \"1226046632\", \n \"_rev\" : \"1226046632\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1224932520\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1225129128\", \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\" : \"1229061288\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1229257896\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1229520040\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1229716648\", \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\" : \"1233517736\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1234369704\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1233714344\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1233517736\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1235221672\", \n \"_key\" : \"1235221672\", \n \"_rev\" : \"1235221672\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1233517736\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1234369704\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1235221672\", \n \"_key\" : \"1235221672\", \n \"_rev\" : \"1235221672\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1235418280\", \n \"_key\" : \"1235418280\", \n \"_rev\" : \"1235418280\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1233517736\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1234369704\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1233714344\", \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\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1238301864\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1238498472\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1238301864\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1238498472\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1239547048\", \n \"_key\" : \"1239547048\", \n \"_rev\" : \"1239547048\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1239547048\", \n \"_key\" : \"1239547048\", \n \"_rev\" : \"1239547048\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1239743656\", \n \"_key\" : \"1239743656\", \n \"_rev\" : \"1239743656\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1239547048\", \n \"_key\" : \"1239547048\", \n \"_rev\" : \"1239547048\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1239743656\", \n \"_key\" : \"1239743656\", \n \"_rev\" : \"1239743656\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1238957224\", \n \"_key\" : \"1238957224\", \n \"_rev\" : \"1238957224\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1239547048\", \n \"_key\" : \"1239547048\", \n \"_rev\" : \"1239547048\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1239743656\", \n \"_key\" : \"1239743656\", \n \"_rev\" : \"1239743656\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1239153832\", \n \"_key\" : \"1239153832\", \n \"_rev\" : \"1239153832\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1238301864\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1239547048\", \n \"_key\" : \"1239547048\", \n \"_rev\" : \"1239547048\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1239743656\", \n \"_key\" : \"1239743656\", \n \"_rev\" : \"1239743656\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1239350440\", \n \"_key\" : \"1239350440\", \n \"_rev\" : \"1239350440\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1238498472\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1238957224\", \n \"_key\" : \"1238957224\", \n \"_rev\" : \"1238957224\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1238957224\", \n \"_key\" : \"1238957224\", \n \"_rev\" : \"1238957224\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1239743656\", \n \"_key\" : \"1239743656\", \n \"_rev\" : \"1239743656\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1238957224\", \n \"_key\" : \"1238957224\", \n \"_rev\" : \"1238957224\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1239743656\", \n \"_key\" : \"1239743656\", \n \"_rev\" : \"1239743656\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1239547048\", \n \"_key\" : \"1239547048\", \n \"_rev\" : \"1239547048\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1238695080\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1238957224\", \n \"_key\" : \"1238957224\", \n \"_rev\" : \"1238957224\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1239153832\", \n \"_key\" : \"1239153832\", \n \"_rev\" : \"1239153832\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1238301864\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1238957224\", \n \"_key\" : \"1238957224\", \n \"_rev\" : \"1238957224\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1239350440\", \n \"_key\" : \"1239350440\", \n \"_rev\" : \"1239350440\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1237843112\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1238039720\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1238498472\", \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\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1244462248\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1244658856\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1244462248\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1244658856\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245707432\", \n \"_key\" : \"1245707432\", \n \"_rev\" : \"1245707432\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1245904040\", \n \"_key\" : \"1245904040\", \n \"_rev\" : \"1245904040\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245117608\", \n \"_key\" : \"1245117608\", \n \"_rev\" : \"1245117608\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245707432\", \n \"_key\" : \"1245707432\", \n \"_rev\" : \"1245707432\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1245904040\", \n \"_key\" : \"1245904040\", \n \"_rev\" : \"1245904040\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245314216\", \n \"_key\" : \"1245314216\", \n \"_rev\" : \"1245314216\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1244462248\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245707432\", \n \"_key\" : \"1245707432\", \n \"_rev\" : \"1245707432\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1245904040\", \n \"_key\" : \"1245904040\", \n \"_rev\" : \"1245904040\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245510824\", \n \"_key\" : \"1245510824\", \n \"_rev\" : \"1245510824\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1244658856\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245707432\", \n \"_key\" : \"1245707432\", \n \"_rev\" : \"1245707432\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1245904040\", \n \"_key\" : \"1245904040\", \n \"_rev\" : \"1245904040\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245707432\", \n \"_key\" : \"1245707432\", \n \"_rev\" : \"1245707432\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245117608\", \n \"_key\" : \"1245117608\", \n \"_rev\" : \"1245117608\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245904040\", \n \"_key\" : \"1245904040\", \n \"_rev\" : \"1245904040\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245707432\", \n \"_key\" : \"1245707432\", \n \"_rev\" : \"1245707432\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245117608\", \n \"_key\" : \"1245117608\", \n \"_rev\" : \"1245117608\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245904040\", \n \"_key\" : \"1245904040\", \n \"_rev\" : \"1245904040\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1244855464\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245117608\", \n \"_key\" : \"1245117608\", \n \"_rev\" : \"1245117608\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245314216\", \n \"_key\" : \"1245314216\", \n \"_rev\" : \"1245314216\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1244462248\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245117608\", \n \"_key\" : \"1245117608\", \n \"_rev\" : \"1245117608\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1245510824\", \n \"_key\" : \"1245510824\", \n \"_rev\" : \"1245510824\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1244658856\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1245117608\", \n \"_key\" : \"1245117608\", \n \"_rev\" : \"1245117608\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1244200104\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1244003496\", \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\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1250819240\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1250622632\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1250819240\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1250622632\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251277992\", \n \"_key\" : \"1251277992\", \n \"_rev\" : \"1251277992\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251277992\", \n \"_key\" : \"1251277992\", \n \"_rev\" : \"1251277992\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1251671208\", \n \"_key\" : \"1251671208\", \n \"_rev\" : \"1251671208\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1250819240\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251277992\", \n \"_key\" : \"1251277992\", \n \"_rev\" : \"1251277992\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1251474600\", \n \"_key\" : \"1251474600\", \n \"_rev\" : \"1251474600\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1250622632\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251277992\", \n \"_key\" : \"1251277992\", \n \"_rev\" : \"1251277992\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1252064424\", \n \"_key\" : \"1252064424\", \n \"_rev\" : \"1252064424\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251277992\", \n \"_key\" : \"1251277992\", \n \"_rev\" : \"1251277992\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1252064424\", \n \"_key\" : \"1252064424\", \n \"_rev\" : \"1252064424\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1251867816\", \n \"_key\" : \"1251867816\", \n \"_rev\" : \"1251867816\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251867816\", \n \"_key\" : \"1251867816\", \n \"_rev\" : \"1251867816\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251867816\", \n \"_key\" : \"1251867816\", \n \"_rev\" : \"1251867816\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1252064424\", \n \"_key\" : \"1252064424\", \n \"_rev\" : \"1252064424\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251867816\", \n \"_key\" : \"1251867816\", \n \"_rev\" : \"1251867816\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1252064424\", \n \"_key\" : \"1252064424\", \n \"_rev\" : \"1252064424\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1251671208\", \n \"_key\" : \"1251671208\", \n \"_rev\" : \"1251671208\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1250819240\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251867816\", \n \"_key\" : \"1251867816\", \n \"_rev\" : \"1251867816\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1252064424\", \n \"_key\" : \"1252064424\", \n \"_rev\" : \"1252064424\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1251474600\", \n \"_key\" : \"1251474600\", \n \"_rev\" : \"1251474600\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1250622632\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1251867816\", \n \"_key\" : \"1251867816\", \n \"_rev\" : \"1251867816\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1252064424\", \n \"_key\" : \"1252064424\", \n \"_rev\" : \"1252064424\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1251277992\", \n \"_key\" : \"1251277992\", \n \"_rev\" : \"1251277992\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1251015848\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1250360488\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1250163880\", \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\" : \"1256324264\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257176232\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1256520872\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1256783016\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1256979624\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1258028200\", \n \"_key\" : \"1258028200\", \n \"_rev\" : \"1258028200\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257176232\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1258028200\", \n \"_key\" : \"1258028200\", \n \"_rev\" : \"1258028200\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1258224808\", \n \"_key\" : \"1258224808\", \n \"_rev\" : \"1258224808\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257176232\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1256520872\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1258028200\", \n \"_key\" : \"1258028200\", \n \"_rev\" : \"1258028200\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1258224808\", \n \"_key\" : \"1258224808\", \n \"_rev\" : \"1258224808\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1257438376\", \n \"_key\" : \"1257438376\", \n \"_rev\" : \"1257438376\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257176232\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1256520872\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1258028200\", \n \"_key\" : \"1258028200\", \n \"_rev\" : \"1258028200\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1258224808\", \n \"_key\" : \"1258224808\", \n \"_rev\" : \"1258224808\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1257634984\", \n \"_key\" : \"1257634984\", \n \"_rev\" : \"1257634984\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257176232\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1256520872\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1256783016\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1258028200\", \n \"_key\" : \"1258028200\", \n \"_rev\" : \"1258028200\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1258224808\", \n \"_key\" : \"1258224808\", \n \"_rev\" : \"1258224808\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1257831592\", \n \"_key\" : \"1257831592\", \n \"_rev\" : \"1257831592\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256324264\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257176232\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1256520872\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1256979624\", \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"
|
|
}
|
|
]
|
|
}
|