Dgraph:递归可以进行深度图遍历吗? [英] Dgraph: Deep graph traversal possible with recurse?

查看:231
本文介绍了Dgraph:递归可以进行深度图遍历吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于Dgraph关于图遍历的功能,我有几个问题.

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

比方说,我们有一个数据集,其中包含post类型的节点.每个帖子可以有n条帖子对此帖子进行回复.这棵树的深度没有限制.

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.

使用Dgraph可以搜索从一个起始节点开始的所有叶节点并返回满足特定条件的所有叶吗?

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?

最后:Dgraph中的边缘是否定向?我可以在查询中包括它吗?

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

推荐答案

Dgraph的作者在这里.

Author of Dgraph here.

Dgraph是否有可能通过所有叶节点开始搜索从一个起始节点返回所有满足特定条件的叶子条件?

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?

是的.您可以使用recurse指令( https://docs.dgraph.io/query-language/#recurse-query ).

Yes. You could use the recurse directive (https://docs.dgraph.io/query-language/#recurse-query).

是否可以将深度限制设置为不以巨大的结尾数据集?

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

是的.递归支持最大深度.

Yes. Recursion supports a maximum depth.

是否还可以找到满足一定条件的所有父节点的子节点?

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

是的.您可以遍历一条边,并在其上放置一个滤镜. https://docs.dgraph.io/query-language/#applying-filters

Yes. You can traverse an edge, and put a filter on it. https://docs.dgraph.io/query-language/#applying-filters

最后:Dgraph中的边缘是否定向?我可以在查询中包括它吗?

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

dgraph中的边被定向.但是,Dgraph还支持反向"索引,该索引可用于自动生成反向的边.然后,可以通过在谓词名称之前添加波浪号(〜)来遍历这些反向边缘.

Edges in dgraph are directed. But, Dgraph also supports a "reverse" index, which can be used to automatically generate the edges in the reverse direction. You can then traverse these reverse edges, by adding a tilde (~) in front of the predicate name.

https://docs.dgraph.io/query-language/#reverse-边缘

这篇关于Dgraph:递归可以进行深度图遍历吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆