OrientDB:连接组件 OSQL 查询 [英] OrientDB: connected components OSQL query
本文介绍了OrientDB:连接组件 OSQL 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道如何使用 OrientDB 查询计算图的连通分量吗?我正在尝试复制这里但我缺少类似于用于集合的 REDUCE 运算符的东西.
Does anybody know how to compute the connected components of a graph with an OrientDB query? I'm trying to replicate what was done here but I'm missing something similar to a REDUCE operator for collections.
提前致谢.
推荐答案
此查询
SELECT distinct(traversedElement(0))
FROM (TRAVERSE both('ManagedBy') FROM Employee)
给我返回了正确的结果.一开始我不明白为什么,但后来我发现 TRAVERSE 中使用的默认策略是 DFS 这就是为什么我们可以依靠将每次遍历的第一个节点作为其连接组件的代表.
Returned me the right result. At the beginning I could not understand why but then I figured out that the default strategy used in TRAVERSE is DFS that's why we can rely on taking the first node of each traversal as a representative for its connected component.
这篇关于OrientDB:连接组件 OSQL 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文