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 <<EOF\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\"}\nEOF\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\" : \"1252140085\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1252336693\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1252598837\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1252795445\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1252140085\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253254197\", \n \"_key\" : \"1253254197\", \n \"_rev\" : \"1253254197\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1252140085\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1252336693\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253254197\", \n \"_key\" : \"1253254197\", \n \"_rev\" : \"1253254197\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1253450805\", \n \"_key\" : \"1253450805\", \n \"_rev\" : \"1253450805\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1252140085\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1252336693\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1252598837\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1253254197\", \n \"_key\" : \"1253254197\", \n \"_rev\" : \"1253254197\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1253647413\", \n \"_key\" : \"1253647413\", \n \"_rev\" : \"1253647413\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1252140085\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1252336693\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1252795445\", \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 <<EOF\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"inbound\"}\nEOF\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\" : \"1256596533\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257448501\", \n \"name\" : \"Eve\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256596533\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1258300469\", \n \"_key\" : \"1258300469\", \n \"_rev\" : \"1258300469\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1256596533\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1257448501\", \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 <<EOF\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\nEOF\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\" : \"1260790837\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1261642805\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1260987445\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1261249589\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1261446197\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1262494773\", \n \"_key\" : \"1262494773\", \n \"_rev\" : \"1262494773\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1261642805\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1262494773\", \n \"_key\" : \"1262494773\", \n \"_rev\" : \"1262494773\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1262691381\", \n \"_key\" : \"1262691381\", \n \"_rev\" : \"1262691381\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1261642805\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1260987445\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1262494773\", \n \"_key\" : \"1262494773\", \n \"_rev\" : \"1262494773\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1262691381\", \n \"_key\" : \"1262691381\", \n \"_rev\" : \"1262691381\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1261904949\", \n \"_key\" : \"1261904949\", \n \"_rev\" : \"1261904949\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1261642805\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1260987445\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1262494773\", \n \"_key\" : \"1262494773\", \n \"_rev\" : \"1262494773\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1262691381\", \n \"_key\" : \"1262691381\", \n \"_rev\" : \"1262691381\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1262101557\", \n \"_key\" : \"1262101557\", \n \"_rev\" : \"1262101557\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1261642805\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1260987445\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1261249589\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1262494773\", \n \"_key\" : \"1262494773\", \n \"_rev\" : \"1262494773\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1262691381\", \n \"_key\" : \"1262691381\", \n \"_rev\" : \"1262691381\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1262298165\", \n \"_key\" : \"1262298165\", \n \"_rev\" : \"1262298165\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1260790837\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1261642805\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1260987445\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1261446197\", \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 <<EOF\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\" || vertex.name === \\\"Charlie\\\") {return \\\"exclude\\\";}return;\"}\nEOF\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\" : \"1265968181\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1266623541\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1265968181\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1267082293\", \n \"_key\" : \"1267082293\", \n \"_rev\" : \"1267082293\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1267475509\", \n \"_key\" : \"1267475509\", \n \"_rev\" : \"1267475509\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1265968181\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1266164789\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1266623541\", \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 <<EOF\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\") {return \\\"prune\\\";}return;\"}\nEOF\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\" : \"1270424629\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1270621237\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1270424629\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1271538741\", \n \"_key\" : \"1271538741\", \n \"_rev\" : \"1271538741\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1270424629\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1270621237\", \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 <<EOF\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"minDepth\" : 2}\nEOF\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\" : \"1275012149\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1275208757\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1275667509\", \n \"_key\" : \"1275667509\", \n \"_rev\" : \"1275667509\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1275864117\", \n \"_key\" : \"1275864117\", \n \"_rev\" : \"1275864117\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1274553397\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1274750005\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1275012149\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1275667509\", \n \"_key\" : \"1275667509\", \n \"_rev\" : \"1275667509\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1276060725\", \n \"_key\" : \"1276060725\", \n \"_rev\" : \"1276060725\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1274553397\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1274750005\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1275208757\", \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 <<EOF\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"maxDepth\" : 1}\nEOF\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\" : \"1279009845\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1279206453\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1279009845\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1280123957\", \n \"_key\" : \"1280123957\", \n \"_rev\" : \"1280123957\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1279009845\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1279206453\", \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 <<EOF\n{ \"startVertex\": \"persons/alice\", \"graphName\" : \"knows_graph\", \"direction\" : \"outbound\", \"init\" : \"result.visited = 0; result.myVertices = [ ];\", \"visitor\" : \"result.visited++; result.myVertices.push(vertex);\"}\nEOF\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\" : \"1283138613\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1283335221\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1283597365\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1283793973\", \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 <<EOF\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;\"}\nEOF\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\" : \"1287595061\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1288447029\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1287791669\", \n \"name\" : \"Bob\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1287595061\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1289298997\", \n \"_key\" : \"1289298997\", \n \"_rev\" : \"1289298997\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1287595061\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1288447029\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1289298997\", \n \"_key\" : \"1289298997\", \n \"_rev\" : \"1289298997\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1289495605\", \n \"_key\" : \"1289495605\", \n \"_rev\" : \"1289495605\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1287595061\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1288447029\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1287791669\", \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 <<EOF\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"strategy\":\"depthfirst\"}\nEOF\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\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1292379189\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1292575797\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1292379189\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1292575797\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293624373\", \n \"_key\" : \"1293624373\", \n \"_rev\" : \"1293624373\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293624373\", \n \"_key\" : \"1293624373\", \n \"_rev\" : \"1293624373\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1293820981\", \n \"_key\" : \"1293820981\", \n \"_rev\" : \"1293820981\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293624373\", \n \"_key\" : \"1293624373\", \n \"_rev\" : \"1293624373\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1293820981\", \n \"_key\" : \"1293820981\", \n \"_rev\" : \"1293820981\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293034549\", \n \"_key\" : \"1293034549\", \n \"_rev\" : \"1293034549\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293624373\", \n \"_key\" : \"1293624373\", \n \"_rev\" : \"1293624373\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1293820981\", \n \"_key\" : \"1293820981\", \n \"_rev\" : \"1293820981\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293231157\", \n \"_key\" : \"1293231157\", \n \"_rev\" : \"1293231157\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1292379189\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293624373\", \n \"_key\" : \"1293624373\", \n \"_rev\" : \"1293624373\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1293820981\", \n \"_key\" : \"1293820981\", \n \"_rev\" : \"1293820981\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293427765\", \n \"_key\" : \"1293427765\", \n \"_rev\" : \"1293427765\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1292575797\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293034549\", \n \"_key\" : \"1293034549\", \n \"_rev\" : \"1293034549\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293034549\", \n \"_key\" : \"1293034549\", \n \"_rev\" : \"1293034549\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293820981\", \n \"_key\" : \"1293820981\", \n \"_rev\" : \"1293820981\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293034549\", \n \"_key\" : \"1293034549\", \n \"_rev\" : \"1293034549\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293820981\", \n \"_key\" : \"1293820981\", \n \"_rev\" : \"1293820981\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293624373\", \n \"_key\" : \"1293624373\", \n \"_rev\" : \"1293624373\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1292772405\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293034549\", \n \"_key\" : \"1293034549\", \n \"_rev\" : \"1293034549\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293231157\", \n \"_key\" : \"1293231157\", \n \"_rev\" : \"1293231157\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1292379189\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1293034549\", \n \"_key\" : \"1293034549\", \n \"_rev\" : \"1293034549\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1293427765\", \n \"_key\" : \"1293427765\", \n \"_rev\" : \"1293427765\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1291920437\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1292117045\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1292575797\", \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 <<EOF\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"order\":\"postorder\"}\nEOF\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\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1298539573\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1298736181\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1298539573\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1298736181\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299784757\", \n \"_key\" : \"1299784757\", \n \"_rev\" : \"1299784757\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1299981365\", \n \"_key\" : \"1299981365\", \n \"_rev\" : \"1299981365\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299194933\", \n \"_key\" : \"1299194933\", \n \"_rev\" : \"1299194933\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299784757\", \n \"_key\" : \"1299784757\", \n \"_rev\" : \"1299784757\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1299981365\", \n \"_key\" : \"1299981365\", \n \"_rev\" : \"1299981365\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299391541\", \n \"_key\" : \"1299391541\", \n \"_rev\" : \"1299391541\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1298539573\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299784757\", \n \"_key\" : \"1299784757\", \n \"_rev\" : \"1299784757\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1299981365\", \n \"_key\" : \"1299981365\", \n \"_rev\" : \"1299981365\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299588149\", \n \"_key\" : \"1299588149\", \n \"_rev\" : \"1299588149\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1298736181\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299784757\", \n \"_key\" : \"1299784757\", \n \"_rev\" : \"1299784757\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1299981365\", \n \"_key\" : \"1299981365\", \n \"_rev\" : \"1299981365\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299784757\", \n \"_key\" : \"1299784757\", \n \"_rev\" : \"1299784757\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299194933\", \n \"_key\" : \"1299194933\", \n \"_rev\" : \"1299194933\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299981365\", \n \"_key\" : \"1299981365\", \n \"_rev\" : \"1299981365\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299784757\", \n \"_key\" : \"1299784757\", \n \"_rev\" : \"1299784757\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299194933\", \n \"_key\" : \"1299194933\", \n \"_rev\" : \"1299194933\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299981365\", \n \"_key\" : \"1299981365\", \n \"_rev\" : \"1299981365\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1298932789\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299194933\", \n \"_key\" : \"1299194933\", \n \"_rev\" : \"1299194933\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299391541\", \n \"_key\" : \"1299391541\", \n \"_rev\" : \"1299391541\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1298539573\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299194933\", \n \"_key\" : \"1299194933\", \n \"_rev\" : \"1299194933\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1299588149\", \n \"_key\" : \"1299588149\", \n \"_rev\" : \"1299588149\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1298736181\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1299194933\", \n \"_key\" : \"1299194933\", \n \"_rev\" : \"1299194933\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1298277429\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1298080821\", \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 <<EOF\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"itemOrder\":\"backward\"}\nEOF\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\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1304896565\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1304699957\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1304896565\", \n \"name\" : \"Dave\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1304699957\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305355317\", \n \"_key\" : \"1305355317\", \n \"_rev\" : \"1305355317\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305355317\", \n \"_key\" : \"1305355317\", \n \"_rev\" : \"1305355317\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1305748533\", \n \"_key\" : \"1305748533\", \n \"_rev\" : \"1305748533\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1304896565\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305355317\", \n \"_key\" : \"1305355317\", \n \"_rev\" : \"1305355317\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1305551925\", \n \"_key\" : \"1305551925\", \n \"_rev\" : \"1305551925\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1304699957\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305355317\", \n \"_key\" : \"1305355317\", \n \"_rev\" : \"1305355317\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1306141749\", \n \"_key\" : \"1306141749\", \n \"_rev\" : \"1306141749\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305355317\", \n \"_key\" : \"1305355317\", \n \"_rev\" : \"1305355317\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1306141749\", \n \"_key\" : \"1306141749\", \n \"_rev\" : \"1306141749\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1305945141\", \n \"_key\" : \"1305945141\", \n \"_rev\" : \"1305945141\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305945141\", \n \"_key\" : \"1305945141\", \n \"_rev\" : \"1305945141\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305945141\", \n \"_key\" : \"1305945141\", \n \"_rev\" : \"1305945141\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1306141749\", \n \"_key\" : \"1306141749\", \n \"_rev\" : \"1306141749\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305945141\", \n \"_key\" : \"1305945141\", \n \"_rev\" : \"1305945141\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1306141749\", \n \"_key\" : \"1306141749\", \n \"_rev\" : \"1306141749\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1305748533\", \n \"_key\" : \"1305748533\", \n \"_rev\" : \"1305748533\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1304896565\", \n \"name\" : \"Dave\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305945141\", \n \"_key\" : \"1305945141\", \n \"_rev\" : \"1305945141\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1306141749\", \n \"_key\" : \"1306141749\", \n \"_rev\" : \"1306141749\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1305551925\", \n \"_key\" : \"1305551925\", \n \"_rev\" : \"1305551925\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1304699957\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1305945141\", \n \"_key\" : \"1305945141\", \n \"_rev\" : \"1305945141\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1306141749\", \n \"_key\" : \"1306141749\", \n \"_rev\" : \"1306141749\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1305355317\", \n \"_key\" : \"1305355317\", \n \"_rev\" : \"1305355317\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1305093173\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1304437813\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1304241205\", \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 <<EOF\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\nEOF\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\" : \"1310401589\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1311253557\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1310598197\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1310860341\", \n \"name\" : \"Charlie\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1311056949\", \n \"name\" : \"Dave\" \n } \n ], \n \"paths\" : [ \n { \n \"edges\" : [ ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1312105525\", \n \"_key\" : \"1312105525\", \n \"_rev\" : \"1312105525\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1311253557\", \n \"name\" : \"Eve\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1312105525\", \n \"_key\" : \"1312105525\", \n \"_rev\" : \"1312105525\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1312302133\", \n \"_key\" : \"1312302133\", \n \"_rev\" : \"1312302133\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1311253557\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1310598197\", \n \"name\" : \"Bob\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1312105525\", \n \"_key\" : \"1312105525\", \n \"_rev\" : \"1312105525\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1312302133\", \n \"_key\" : \"1312302133\", \n \"_rev\" : \"1312302133\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1311515701\", \n \"_key\" : \"1311515701\", \n \"_rev\" : \"1311515701\", \n \"_from\" : \"persons/alice\", \n \"_to\" : \"persons/bob\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1311253557\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1310598197\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1312105525\", \n \"_key\" : \"1312105525\", \n \"_rev\" : \"1312105525\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1312302133\", \n \"_key\" : \"1312302133\", \n \"_rev\" : \"1312302133\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1311712309\", \n \"_key\" : \"1311712309\", \n \"_rev\" : \"1311712309\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/charlie\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1311253557\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1310598197\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/charlie\", \n \"_key\" : \"charlie\", \n \"_rev\" : \"1310860341\", \n \"name\" : \"Charlie\" \n } \n ] \n }, \n { \n \"edges\" : [ \n { \n \"_id\" : \"knows/1312105525\", \n \"_key\" : \"1312105525\", \n \"_rev\" : \"1312105525\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/alice\" \n }, \n { \n \"_id\" : \"knows/1312302133\", \n \"_key\" : \"1312302133\", \n \"_rev\" : \"1312302133\", \n \"_from\" : \"persons/eve\", \n \"_to\" : \"persons/bob\" \n }, \n { \n \"_id\" : \"knows/1311908917\", \n \"_key\" : \"1311908917\", \n \"_rev\" : \"1311908917\", \n \"_from\" : \"persons/bob\", \n \"_to\" : \"persons/dave\" \n } \n ], \n \"vertices\" : [ \n { \n \"_id\" : \"persons/alice\", \n \"_key\" : \"alice\", \n \"_rev\" : \"1310401589\", \n \"name\" : \"Alice\" \n }, \n { \n \"_id\" : \"persons/eve\", \n \"_key\" : \"eve\", \n \"_rev\" : \"1311253557\", \n \"name\" : \"Eve\" \n }, \n { \n \"_id\" : \"persons/bob\", \n \"_key\" : \"bob\", \n \"_rev\" : \"1310598197\", \n \"name\" : \"Bob\" \n }, \n { \n \"_id\" : \"persons/dave\", \n \"_key\" : \"dave\", \n \"_rev\" : \"1311056949\", \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 <<EOF\n{\"startVertex\":\"persons/alice\",\"graphName\":\"knows_graph\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"none\"},\"maxIterations\":5}\nEOF\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 - try increasing the value of 'maxIterations'\" \n}\n</code></pre><br><br><br> <br><br>",
|
|
"nickname": "executesATraversal"
|
|
}
|
|
],
|
|
"path": "/_api/traversal"
|
|
}
|
|
]
|
|
}
|