HTTP Interface for Traversals
Traversals
ArangoDB's graph traversals are executed on the server. Traversals can be initiated by clients by sending the traversal description for execution to the server.
Traversals in ArangoDB are used to walk over a graph stored in one edge collection. It can easily be described which edges of the graph should be followed and which actions should be performed on each visited vertex. Furthermore the ordering of visiting the nodes can be specified, for instance depth-first or breadth-first search are offered.
Executing Traversals via HTTP
executes a traversal
execute a server-side traversal
POST /_api/traversal
Starts a traversal starting from a given vertex and following. edges contained in a given edgeCollection. The request must contain the following attributes.
A json post document with these Properties is required:
- sort: 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.
- direction: direction for traversal
- if set, must be either "outbound", "inbound", or "any"
- if not set, the expander attribute must be specified
- minDepth: ANDed with any existing filters): visits only nodes in at least the given depth
- startVertex: id of the startVertex, e.g. "users/foo".
- visitor: body (JavaScript) code of custom visitor function function signature: (config, result, vertex, path, connected) -> void The visitor function can do anything, but its return value is ignored. To populate a result, use the result variable by reference. Note that the connected argument is only populated when the order attribute is set to "preorder-expander".
- itemOrder: item iteration order can be "forward" or "backward"
- strategy: traversal strategy can be "depthfirst" or "breadthfirst"
- filter: 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:
- "exclude" -> this vertex will not be visited.
- "prune" -> the edges of this vertex will not be followed.
- "" or undefined -> visit the vertex and follow it's edges.
- Array -> containing any combination of the above. If there is at least one "exclude" or "prune" respectivly is contained, it's effect will occur.
- init: body (JavaScript) code of custom result initialization function function signature: (config, result) -> void initialize any values in result with what is required
- maxIterations: 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 maxIterations value, the traversal will abort with an error. If maxIterations is not set, a server-defined value may be used.
- maxDepth: ANDed with any existing filters visits only nodes in at most the given depth
- uniqueness: specifies uniqueness for vertices and edges visited.
If set, must be an object like this:
"uniqueness": {"vertices": "none"|"global"|"path", "edges": "none"|"global"|"path"}
- order: traversal order can be "preorder", "postorder" or "preorder-expander"
- graphName: name of the graph that contains the edges. Either edgeCollection or graphName has to be given. In case both values are set the graphName is prefered.
- expander: body (JavaScript) code of custom expander function must be set if direction attribute is not set function signature: (config, vertex, path) -> array expander must return an array of the connections for vertex each connection is an object with the attributes edge and vertex
- edgeCollection: name of the collection that contains the edges.
If the Traversal is successfully executed HTTP 200 will be returned. Additionally the result object will be returned by the traversal.
For successful traversals, the returned JSON object has the following properties:
error: boolean flag to indicate if an error occurred (false in this case)
code: the HTTP status code
result: the return value of the traversal
If the traversal specification is either missing or malformed, the server will respond with HTTP 400.
The body of the response will then contain a JSON object with additional error details. The object has the following attributes:
error: boolean flag to indicate that an error occurred (true in this case)
code: the HTTP status code
errorNum: the server error number
errorMessage: a descriptive error message
Example:
In the following examples the underlying graph will contain five persons Alice, Bob, Charlie, Dave and Eve. We will have the following directed relations:
- Alice knows Bob
- Bob knows Charlie
- Bob knows Dave
- Eve knows Alice
- Eve knows Bob
The starting vertex will always be Alice.
Follow only outbound edges
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XYS---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XYS--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11883",
"_id" : "knows/11883",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XYW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11883",
"_id" : "knows/11883",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XYW--_"
},
{
"_key" : "11887",
"_id" : "knows/11887",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4XYW--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XYS---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11883",
"_id" : "knows/11883",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XYW--_"
},
{
"_key" : "11890",
"_id" : "knows/11890",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4XYa---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XYS--_",
"name" : "Dave"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Follow only inbound edges
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "inbound"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WRe---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4WRm--_",
"name" : "Eve"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WRe---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11646",
"_id" : "knows/11646",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4WRu---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WRe---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4WRm--_",
"name" : "Eve"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Follow any direction of edges
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "global"
}
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Usq--_",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Usq--A",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Usu---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11229",
"_id" : "knows/11229",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Us2---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Usq--_",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11232",
"_id" : "knows/11232",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Us2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Usq--A",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11238",
"_id" : "knows/11238",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Us6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Usu---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11238",
"_id" : "knows/11238",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Us6---"
},
{
"_key" : "11235",
"_id" : "knows/11235",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Us2--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Usu---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Excluding Charlie and Bob
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"filter" : "if (vertex.name === \"Bob\" || vertex.name === \"Charlie\") { return \"exclude\";}return;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vym---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vyq--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vym---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11527",
"_id" : "knows/11527",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vyu---"
},
{
"_key" : "11534",
"_id" : "knows/11534",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Vyy---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vym---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vym--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vyq--_",
"name" : "Dave"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Do not follow edges from Bob
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"filter" : "if (vertex.name === \"Bob\") {return \"prune\";}return;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WCy---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WCy--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WCy---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11584",
"_id" : "knows/11584",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4WC6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WCy---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WCy--_",
"name" : "Bob"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Visit only nodes in a depth of at least 2
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"minDepth" : 2
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XJG--_",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XJG--A",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "11826",
"_id" : "knows/11826",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XJK--_"
},
{
"_key" : "11830",
"_id" : "knows/11830",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4XJK--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XJC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XJG---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XJG--_",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11826",
"_id" : "knows/11826",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XJK--_"
},
{
"_key" : "11833",
"_id" : "knows/11833",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4XJO---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XJC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XJG---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XJG--A",
"name" : "Dave"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Visit only nodes in a depth of at most 1
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"maxDepth" : 1
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WgK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WgO---",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WgK---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11689",
"_id" : "knows/11689",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4WgW---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WgK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WgO---",
"name" : "Bob"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Using a visitor function to return vertex ids only
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"visitor" : "result.visited.vertices.push(vertex._id);"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
"persons/alice",
"persons/bob",
"persons/charlie",
"persons/dave"
],
"paths" : [ ]
}
},
"error" : false,
"code" : 200
}
Example:
Count all visited nodes and return a list of nodes only
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"init" : "result.visited = 0; result.myVertices = [ ];",
"visitor" : "result.visited++; result.myVertices.push(vertex);"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : 4,
"myVertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YTW---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4YTW--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4YTa---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4YTa--_",
"name" : "Dave"
}
]
},
"error" : false,
"code" : 200
}
Example:
Expand only inbound edges of Alice and outbound edges of Eve
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"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;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4YlS---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4YlK--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12090",
"_id" : "knows/12090",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Yla---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4YlS---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "12090",
"_id" : "knows/12090",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Yla---"
},
{
"_key" : "12093",
"_id" : "knows/12093",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Yla--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4YlS---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4YlK--_",
"name" : "Bob"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Follow the depthfirst strategy
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"strategy" : "depthfirst"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11380",
"_id" : "knows/11380",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4VPC--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11383",
"_id" : "knows/11383",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4VPG---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11380",
"_id" : "knows/11380",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4VPC--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11383",
"_id" : "knows/11383",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4VPG---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Using postorder ordering
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"order" : "postorder"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11944",
"_id" : "knows/11944",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Y_----"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11947",
"_id" : "knows/11947",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Y_---_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11944",
"_id" : "knows/11944",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Y_----"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11947",
"_id" : "knows/11947",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Y_---_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
}
]
},
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Using backward item-ordering:
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"itemOrder" : "backward"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11300",
"_id" : "knows/11300",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4V-2---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11297",
"_id" : "knows/11297",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4V-y--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11300",
"_id" : "knows/11300",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4V-2---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11297",
"_id" : "knows/11297",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4V-y--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
Edges should only be included once globally, but nodes are included every time they are visited
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "global"
}
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Vfy---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vfy--_",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Vf2---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11463",
"_id" : "knows/11463",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Vf6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Vfy---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11466",
"_id" : "knows/11466",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Vf6--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vfy--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11472",
"_id" : "knows/11472",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Vg---_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Vf2---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11472",
"_id" : "knows/11472",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Vg---_"
},
{
"_key" : "11469",
"_id" : "knows/11469",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Vg----"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Vf2---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
Example:
If the underlying graph is cyclic, maxIterations should be set
The underlying graph has two vertices Alice and Bob. With the directed edges:
- Alice knows Bob
- Bob knows Alice
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "none"
},
"maxIterations" : 5
}
EOF
HTTP/1.1 500 Internal Server Error
content-type: application/json; charset=utf-8
{
"error" : true,
"code" : 500,
"errorNum" : 1909,
"errorMessage" : "too many iterations - try increasing the value of 'maxIterations'"
}
Return Codes
- 200: If the traversal is fully executed HTTP 200 will be returned.
- 400: If the traversal specification is either missing or malformed, the server will respond with HTTP 400.
- 404: The server will responded with HTTP 404 if the specified edge collection does not exist, or the specified start vertex cannot be found.
- 500: The server will responded with HTTP 500 when an error occurs inside the traversal or if a traversal performs more than maxIterations iterations.
Examples
In the following examples the underlying graph will contain five persons Alice, Bob, Charlie, Dave and Eve. We will have the following directed relations:
- Alice knows Bob
- Bob knows Charlie
- Bob knows Dave
- Eve knows Alice
- Eve knows Bob The starting vertex will always be Alice. Follow only outbound edges
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XYS---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XYS--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11883",
"_id" : "knows/11883",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XYW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11883",
"_id" : "knows/11883",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XYW--_"
},
{
"_key" : "11887",
"_id" : "knows/11887",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4XYW--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XYS---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11883",
"_id" : "knows/11883",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XYW--_"
},
{
"_key" : "11890",
"_id" : "knows/11890",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4XYa---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XYO---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XYO--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XYS--_",
"name" : "Dave"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Follow only inbound edges
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "inbound"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WRe---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4WRm--_",
"name" : "Eve"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WRe---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11646",
"_id" : "knows/11646",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4WRu---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WRe---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4WRm--_",
"name" : "Eve"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "inbound"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Follow any direction of edges
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "global"
}
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Usq--_",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Usq--A",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Usu---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11229",
"_id" : "knows/11229",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Us2---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Usq--_",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11232",
"_id" : "knows/11232",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Us2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Usq--A",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11238",
"_id" : "knows/11238",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Us6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Usu---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11225",
"_id" : "knows/11225",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Usy---"
},
{
"_key" : "11238",
"_id" : "knows/11238",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Us6---"
},
{
"_key" : "11235",
"_id" : "knows/11235",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Us2--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Usq---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Usu---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Usm---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "global"
}
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Excluding Charlie and Bob
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"filter" : "if (vertex.name === \"Bob\" || vertex.name === \"Charlie\") { return \"exclude\";}return;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vym---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vyq--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vym---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11527",
"_id" : "knows/11527",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vyu---"
},
{
"_key" : "11534",
"_id" : "knows/11534",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Vyy---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vym---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vym--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vyq--_",
"name" : "Dave"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"filter" : "if (vertex.name === \"Bob\" || vertex.name === \"Charlie\") { return \"exclude\";}return;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Do not follow edges from Bob
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"filter" : "if (vertex.name === \"Bob\") {return \"prune\";}return;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WCy---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WCy--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WCy---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11584",
"_id" : "knows/11584",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4WC6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WCy---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WCy--_",
"name" : "Bob"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"filter" : "if (vertex.name === \"Bob\") {return \"prune\";}return;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Visit only nodes in a depth of at least 2
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"minDepth" : 2
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XJG--_",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XJG--A",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "11826",
"_id" : "knows/11826",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XJK--_"
},
{
"_key" : "11830",
"_id" : "knows/11830",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4XJK--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XJC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XJG---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4XJG--_",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11826",
"_id" : "knows/11826",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4XJK--_"
},
{
"_key" : "11833",
"_id" : "knows/11833",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4XJO---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4XJC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4XJG---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4XJG--A",
"name" : "Dave"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"minDepth" : 2
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Visit only nodes in a depth of at most 1
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"maxDepth" : 1
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WgK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WgO---",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WgK---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11689",
"_id" : "knows/11689",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4WgW---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4WgK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4WgO---",
"name" : "Bob"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"maxDepth" : 1
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Using a visitor function to return vertex ids only
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"visitor" : "result.visited.vertices.push(vertex._id);"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
"persons/alice",
"persons/bob",
"persons/charlie",
"persons/dave"
],
"paths" : [ ]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"visitor" : "result.visited.vertices.push(vertex._id);"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Count all visited nodes and return a list of nodes only
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"init" : "result.visited = 0; result.myVertices = [ ];",
"visitor" : "result.visited++; result.myVertices.push(vertex);"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : 4,
"myVertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YTW---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4YTW--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4YTa---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4YTa--_",
"name" : "Dave"
}
]
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "outbound",
"init" : "result.visited = 0; result.myVertices = [ ];",
"visitor" : "result.visited++; result.myVertices.push(vertex);"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Expand only inbound edges of Alice and outbound edges of Eve
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"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;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4YlS---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4YlK--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12090",
"_id" : "knows/12090",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Yla---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4YlS---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "12090",
"_id" : "knows/12090",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Yla---"
},
{
"_key" : "12093",
"_id" : "knows/12093",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Yla--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4YlK---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4YlS---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4YlK--_",
"name" : "Bob"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"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;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Follow the depthfirst strategy
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"strategy" : "depthfirst"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11380",
"_id" : "knows/11380",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4VPC--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11383",
"_id" : "knows/11383",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4VPG---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11380",
"_id" : "knows/11380",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4VPC--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4VP----",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11383",
"_id" : "knows/11383",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4VPG---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4VP---_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11386",
"_id" : "knows/11386",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4VPG--_"
},
{
"_key" : "11389",
"_id" : "knows/11389",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4VPG--A"
},
{
"_key" : "11376",
"_id" : "knows/11376",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4VPC---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4VP---A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4VO6--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4VO6---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"strategy" : "depthfirst"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Using postorder ordering
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"order" : "postorder"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11944",
"_id" : "knows/11944",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Y_----"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11947",
"_id" : "knows/11947",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Y_---_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11944",
"_id" : "knows/11944",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Y_----"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Y-2---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11947",
"_id" : "knows/11947",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Y_---_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Y-2--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
},
{
"_key" : "11940",
"_id" : "knows/11940",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Y-6--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
},
{
"_key" : "11953",
"_id" : "knows/11953",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Y_C--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Y-y--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11950",
"_id" : "knows/11950",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Y_C---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Y-6---",
"name" : "Eve"
}
]
},
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Y-y---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"order" : "postorder"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Using backward item-ordering:
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"itemOrder" : "backward"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11300",
"_id" : "knows/11300",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4V-2---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11297",
"_id" : "knows/11297",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4V-y--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11306",
"_id" : "knows/11306",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4V-6---"
},
{
"_key" : "11303",
"_id" : "knows/11303",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4V-2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4V-u--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11300",
"_id" : "knows/11300",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4V-2---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4V-u--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11293",
"_id" : "knows/11293",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4V-y---"
},
{
"_key" : "11297",
"_id" : "knows/11297",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4V-y--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4V-q---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4V-q--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4V-u---",
"name" : "Charlie"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"itemOrder" : "backward"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
Edges should only be included once globally, but nodes are included every time they are visited
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "global"
}
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Vfy---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vfy--_",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Vf2---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11463",
"_id" : "knows/11463",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_Uau4Vf6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_Uau4Vfy---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11466",
"_id" : "knows/11466",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_Uau4Vf6--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_Uau4Vfy--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11472",
"_id" : "knows/11472",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Vg---_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Vf2---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11459",
"_id" : "knows/11459",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_Uau4Vf2--_"
},
{
"_key" : "11472",
"_id" : "knows/11472",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Uau4Vg---_"
},
{
"_key" : "11469",
"_id" : "knows/11469",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Uau4Vg----"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Uau4Vfu--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Uau4Vf2---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Uau4Vfu---",
"name" : "Alice"
}
]
}
]
}
},
"error" : false,
"code" : 200
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "global"
}
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
If the underlying graph is cyclic, maxIterations should be set The underlying graph has two vertices Alice and Bob. With the directed edges:
- Alice knows Bob
- Bob knows Alice
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "none"
},
"maxIterations" : 5
}
EOF
HTTP/1.1 500 Internal Server Error
content-type: application/json; charset=utf-8
{
"error" : true,
"code" : 500,
"errorNum" : 1909,
"errorMessage" : "too many iterations - try increasing the value of 'maxIterations'"
}
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"direction" : "any",
"uniqueness" : {
"vertices" : "none",
"edges" : "none"
},
"maxIterations" : 5
}
EOF
HTTP/1.1 500 Internal Server Error
content-type: application/json; charset=utf-8
All examples were using this graph: