- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
关于 Dgraph 在图遍历方面的功能,我有几个问题。
假设我们有一个由 post 类型的节点组成的数据集。每个帖子可以有 n 个帖子,这些帖子是对该帖子的回复。这棵树的深度没有限制。
Dgraph是否可以从一个起始节点开始搜索所有叶子节点并返回满足特定条件的所有叶子?
是否可以设置深度限制以不以庞大的数据集结束?
是否也可以找到所有满足某个条件的父节点的子节点?
最后:Dgraph 中的边是有向的吗?我可以将其包含在查询中吗?
最佳答案
这里是 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?
是的。您可以使用递归指令 ( https://docs.dgraph.io/query-language/#recurse-query )。
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?
是的。您可以遍历一条边,并在其上放置一个过滤器。 https://docs.dgraph.io/query-language/#applying-filters
And finally: Are edges in Dgraph directed? And can I include that in the query?
dgraph 中的边是有向的。但是,Dgraph 还支持“反向”索引,可用于自动生成反向边。然后,您可以通过在谓词名称前添加波浪号 (~) 来遍历这些反向边。
关于database - Dgraph:递归可以进行深度图遍历吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48895150/
我是一名优秀的程序员,十分优秀!