OrientDB: connected components OSQL query

社会主义新天地 提交于 2019-11-29 23:25:20

问题


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.

Thanks in advance.


回答1:


This query

SELECT distinct(traversedElement(0)) 
FROM (TRAVERSE both('ManagedBy') FROM Employee)

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.



来源:https://stackoverflow.com/questions/33654067/orientdb-connected-components-osql-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!