Hi there, I am new in using Dgraph.
I need some help in counting distinct nodes at 2-Hop from a random node in a graph.
For schema, I did not specify it before loading data. The data is :
[
{
"uid": "3235527",
"knows": {
"uid": "527594"
}
}
]
The json-data is transformed from Graph500 dataset.
My demand is to count distinct nodes at 2-Hop from a random node in a graph, like cypher
MATCH (n1)-[:MyEdge*0..2]->(n2)
WHERE id(n1)=2677094
RETURN count(distinct n2)
I tried query like, thinking it would may flatted the “2-hop knows”:
{
all(func: uid(2677094)) {
knows{
knows{
x as uid
}
}
val(x)
}
}
However, the result is still not flatten that I can not dedup the result from each knows->knows.
Can anybody help me?