Ok,
yes, you can do this with the pattern matching traversals
(https://docs.arangodb.com/Aql/GraphTraversals.html ) or the
GRAPH_NEIGHBOURS (
https://docs.arangodb.com/Aql/GraphOperations.html#graph_neighbors )
functions.
However, until the release of 3.0 there is one restriction: you have to
manually add the start node to the query result.
You would do so by traversing ANY with a huge depth (depending on the
amount of computing time you want to spend on this).
A Query using the Pattern matching traversals could look like this:
var examples = require("org/arangodb/graph-examples/example-graph.js");
var graph = examples.loadGraph("traversalGraph");
db._query(`
LET startNode=(RETURN [document('circles/A')])
LET traversalResult=(FOR v IN 1..100000000000 ANY 'circles/A' GRAPH
'traversalGraph' RETURN v)
RETURN APPEND(startNode, traversalResult)
`).toArray()
If you also want to fetch the edges connecting the vertices, you can also
return them like this:
db._query(`
LET startNode=(RETURN [document('circles/A')])
LET traversalResult=(FOR v,e IN 1..100000000000 ANY 'circles/A' GRAPH
'traversalGraph' RETURN {v: v, e: e})
RETURN {vertices: APPEND(startNode, traversalResult[*].v), edges:
traversalResult[*].e}
`).toArray()
Hope this helps,
Willi
On Wednesday, May 18, 2016 at 10:39:31 AM UTC+2, Руслан Биккинин wrote:
>
> No, i mean how to find graph's connected components
> https://en.wikipedia.org/wiki/Connected_component_(graph_theory)
>
--
You received this message because you are subscribed to the Google Groups
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.