Deep graph traversal possible with recurse?

I have a couple of questions regarding the capabilities of Dgraph regarding graph traversal.

Let’s say we have a dataset that consists of nodes of the type post. Each post can have n posts that are replies to this post. The depth of this tree is not limited.

Is it possible with Dgraph to search trough all leaf nodes starting from one starting node and return all leafs that fulfill a certain condition?

Is it possible to set a depth limit to not end up with a gigantic dataset?

Is it also possible to find the children of all parent nodes that fulfill a certain condition?

And finally: Are edges in Dgraph directed? And can I include that in the query?

1 Like

Most of the things you mentioned are possible. You should have a look at Recurse directive and play around with it.

Edges in Dgraph are directed, yes. If you add a reverse directive for a predicate in the schema, then Dgraph would automatically add edges in the other direction too, which can be accessed by appending a ~ before the name of the predicate.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.