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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZmO---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZmO--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12037",
"_id" : "knows/12037",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZmS--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "12037",
"_id" : "knows/12037",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZmS--_"
},
{
"_key" : "12041",
"_id" : "knows/12041",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZmW---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZmO---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "12037",
"_id" : "knows/12037",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZmS--_"
},
{
"_key" : "12044",
"_id" : "knows/12044",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZmW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZmO--_",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZQy---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZQ2---",
"name" : "Eve"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZQy---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11788",
"_id" : "knows/11788",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZQ6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZQy---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZQ2---",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY0G--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY0G--B",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY0G--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11353",
"_id" : "knows/11353",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHY0K--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY0G--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11356",
"_id" : "knows/11356",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHY0K--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY0G--B",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11362",
"_id" : "knows/11362",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY0O---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY0G--C",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11362",
"_id" : "knows/11362",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY0O---"
},
{
"_key" : "11359",
"_id" : "knows/11359",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY0K--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY0G--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZIq--_",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZIu--A",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZIq--_",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11663",
"_id" : "knows/11663",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZIu--C"
},
{
"_key" : "11670",
"_id" : "knows/11670",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZIy---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZIq--_",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZIu---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZIu--A",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZMm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZMm--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZMm---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11723",
"_id" : "knows/11723",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZMq--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZMm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZMm--_",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZfi---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZfi--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "11977",
"_id" : "knows/11977",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZfi--B"
},
{
"_key" : "11981",
"_id" : "knows/11981",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZfi--C"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZfe--_",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZfe--A",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZfi---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11977",
"_id" : "knows/11977",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZfi--B"
},
{
"_key" : "11984",
"_id" : "knows/11984",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZfm---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZfe--_",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZfe--A",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZfi--_",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZVm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZVm--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZVm---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11834",
"_id" : "knows/11834",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZVu---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZVm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZVm--_",
"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
x-content-type-options: nosniff
{
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : 4,
"myVertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZy2---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZy2--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZy2--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZy6---",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ5O--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ5K--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12253",
"_id" : "knows/12253",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ5S--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ5O--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "12253",
"_id" : "knows/12253",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ5S--A"
},
{
"_key" : "12256",
"_id" : "knows/12256",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ5S--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ5O--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ5K--_",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11510",
"_id" : "knows/11510",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZ_S--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11513",
"_id" : "knows/11513",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZ_S--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11510",
"_id" : "knows/11510",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZ_S--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11513",
"_id" : "knows/11513",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZ_S--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12101",
"_id" : "knows/12101",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZtW--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12104",
"_id" : "knows/12104",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZta---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12101",
"_id" : "knows/12101",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZtW--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12104",
"_id" : "knows/12104",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZta---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
}
]
},
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"name" : "Charlie"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"name" : "Charlie"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11427",
"_id" : "knows/11427",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHY5m--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11424",
"_id" : "knows/11424",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHY5m---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11427",
"_id" : "knows/11427",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHY5m--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11424",
"_id" : "knows/11424",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHY5m---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZEG---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZEG--_",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZEG--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11596",
"_id" : "knows/11596",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZEK--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZEG---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11599",
"_id" : "knows/11599",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZEK--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZEG--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11605",
"_id" : "knows/11605",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZEO--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZEG--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11605",
"_id" : "knows/11605",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZEO--_"
},
{
"_key" : "11602",
"_id" : "knows/11602",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZEO---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZEG--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"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
x-content-type-options: nosniff
{
"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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZmO---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZmO--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12037",
"_id" : "knows/12037",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZmS--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "12037",
"_id" : "knows/12037",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZmS--_"
},
{
"_key" : "12041",
"_id" : "knows/12041",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZmW---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZmO---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "12037",
"_id" : "knows/12037",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZmS--_"
},
{
"_key" : "12044",
"_id" : "knows/12044",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZmW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZmK---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZmK--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZmO--_",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZQy---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZQ2---",
"name" : "Eve"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZQy---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11788",
"_id" : "knows/11788",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZQ6---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZQy---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZQ2---",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY0G--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY0G--B",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY0G--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11353",
"_id" : "knows/11353",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHY0K--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY0G--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11356",
"_id" : "knows/11356",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHY0K--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY0G--B",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11362",
"_id" : "knows/11362",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY0O---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY0G--C",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11349",
"_id" : "knows/11349",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY0K---"
},
{
"_key" : "11362",
"_id" : "knows/11362",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY0O---"
},
{
"_key" : "11359",
"_id" : "knows/11359",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY0K--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY0G--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY0G--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY0G---",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZIq--_",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZIu--A",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZIq--_",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11663",
"_id" : "knows/11663",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZIu--C"
},
{
"_key" : "11670",
"_id" : "knows/11670",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZIy---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZIq--_",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZIu---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZIu--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",
"filter" : "if (vertex.name === \"Bob\" || vertex.name === \"Charlie\") { return \"exclude\";}return;"
}
EOF
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZMm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZMm--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZMm---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11723",
"_id" : "knows/11723",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZMq--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZMm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZMm--_",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZfi---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZfi--_",
"name" : "Dave"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "11977",
"_id" : "knows/11977",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZfi--B"
},
{
"_key" : "11981",
"_id" : "knows/11981",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZfi--C"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZfe--_",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZfe--A",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZfi---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11977",
"_id" : "knows/11977",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZfi--B"
},
{
"_key" : "11984",
"_id" : "knows/11984",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZfm---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZfe--_",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZfe--A",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZfi--_",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZVm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZVm--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZVm---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11834",
"_id" : "knows/11834",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZVu---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZVm---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZVm--_",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : 4,
"myVertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZy2---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZy2--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZy2--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZy6---",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ5O--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ5K--_",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12253",
"_id" : "knows/12253",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ5S--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ5O--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "12253",
"_id" : "knows/12253",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ5S--A"
},
{
"_key" : "12256",
"_id" : "knows/12256",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ5S--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ5K---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ5O--A",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ5K--_",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11510",
"_id" : "knows/11510",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZ_S--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11513",
"_id" : "knows/11513",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZ_S--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11510",
"_id" : "knows/11510",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZ_S--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZ_O--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11513",
"_id" : "knows/11513",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZ_S--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZ_O--B",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11516",
"_id" : "knows/11516",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZ_S--B"
},
{
"_key" : "11519",
"_id" : "knows/11519",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S--C"
},
{
"_key" : "11506",
"_id" : "knows/11506",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZ_S---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZ_O--C",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZ_O--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZ_O---",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12101",
"_id" : "knows/12101",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZtW--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12104",
"_id" : "knows/12104",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZta---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12101",
"_id" : "knows/12101",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZtW--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZtG--A",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12104",
"_id" : "knows/12104",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZta---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZtS---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
},
{
"_key" : "12097",
"_id" : "knows/12097",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZtW--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
},
{
"_key" : "12110",
"_id" : "knows/12110",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZta--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZtG--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "12107",
"_id" : "knows/12107",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZta--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZtW---",
"name" : "Eve"
}
]
},
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZtG---",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"name" : "Charlie"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"name" : "Charlie"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11427",
"_id" : "knows/11427",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHY5m--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11424",
"_id" : "knows/11424",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHY5m---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11433",
"_id" : "knows/11433",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHY5q---"
},
{
"_key" : "11430",
"_id" : "knows/11430",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHY5m--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHY5i--_",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11427",
"_id" : "knows/11427",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHY5m--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHY5i---",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11420",
"_id" : "knows/11420",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHY5i--A"
},
{
"_key" : "11424",
"_id" : "knows/11424",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHY5m---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHY5a---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHY5e---",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHY5e--_",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZEG---",
"name" : "Charlie"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZEG--_",
"name" : "Dave"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZEG--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11596",
"_id" : "knows/11596",
"_from" : "persons/bob",
"_to" : "persons/charlie",
"_rev" : "_VYfHZEK--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "charlie",
"_id" : "persons/charlie",
"_rev" : "_VYfHZEG---",
"name" : "Charlie"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11599",
"_id" : "knows/11599",
"_from" : "persons/bob",
"_to" : "persons/dave",
"_rev" : "_VYfHZEK--A"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "dave",
"_id" : "persons/dave",
"_rev" : "_VYfHZEG--_",
"name" : "Dave"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11605",
"_id" : "knows/11605",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZEO--_"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZEG--A",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "11592",
"_id" : "knows/11592",
"_from" : "persons/alice",
"_to" : "persons/bob",
"_rev" : "_VYfHZEK---"
},
{
"_key" : "11605",
"_id" : "knows/11605",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_VYfHZEO--_"
},
{
"_key" : "11602",
"_id" : "knows/11602",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_VYfHZEO---"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"name" : "Alice"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_VYfHZEC--_",
"name" : "Bob"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_VYfHZEG--A",
"name" : "Eve"
},
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_VYfHZEC---",
"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
x-content-type-options: nosniff
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
x-content-type-options: nosniff
{
"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
x-content-type-options: nosniff
All examples were using this graph: