I want to return a list of all unique edges and all unique vertices met during a graph traversal query. This gives me exactly the result I want, but I'm executing the same query twice:
LET eResults = (
FOR v,e
IN 1..2
ANY "entities/198593"
relations
OPTIONS { uniqueEdges: "path", bfs: true }
RETURN DISTINCT KEEP(e, "_key", "_from", "_to", "type")
)
LET vResults = (
FOR v,e
IN 1..2
ANY "entities/198593"
relations
OPTIONS { uniqueEdges: "path", bfs: true }
RETURN DISTINCT KEEP(v, "_key", "name")
)
RETURN { edges: eResults, vertices: vResults}
The query result, containing each edge and vertice exactly once:
[
{
"edges": [
{
"_from": "entities/198593",
"_key": "391330",
"_to": "entities/198603",
"type": 300
},
{
"_from": "entities/198593",
"_key": "391390",
"_to": "entities/198477",
"type": 110
},
...
],
"vertices": [
{ "_key": "198603", "name": "A" },
{ "_key": "198477", "name": "B" },
...
]
}
]
How can I achieve the same result (unique vertices and unique edges) with one query?
PS: The results are wrapped in an array, any idea why? How to avoid this?