OrientDB: connected components OSQL query

后端 未结 1 882
野性不改
野性不改 2021-01-03 15:52

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

相关标签:
1条回答
  • 2021-01-03 16:17

    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.

    0 讨论(0)
提交回复
热议问题