0

How can I get depth traversal of a graph in Orientdb . Using the documentation here is what I tried , yet when I run in I get an error here is the query .

EXPLAIN SELECT FROM (TRAVERSE any("Edge1") FROM P_H WHILE $depth <= 3) WHERE p ='SP00000000001';

The goal is the get the equivalent of this Neo4j Query :

MATCH (n:Node{NodeID:"SP00000000001"})-[:Edge1*1..3]-(d) RETURN Distinct d, n

Any help would be appreciated

Tom Geudens
  • 2,638
  • 9
  • 15
Muna arr
  • 353
  • 2
  • 13

1 Answers1

1

The easiest thing is using a MATCH statement: http://orientdb.com/docs/2.2.x/SQL-Match.html

 MATCH
   {class:Node, as:n, where:(NodeID = "SP00000000001") -EdgeClass- {as:d, while:($depth < 3), where: ($matched.n != $currentMatch)} }
 RETURN d, n 

Or RETURN $elements if you want the vertices expanded

Luigi Dell'Aquila
  • 2,804
  • 10
  • 13