You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traverse * means traversing all the fields (document model), if you use
regular edges (that is the default) traversing from a vertex to another
means traversing two fields ("out_Class" on the vertex and "in" on the
edge).
To do a correct traversal on Graph API you have to use both() instead of *:
select * from (traverse both() from #14:22 while $depth <=2) where $depth=1
on OpenBeer dataset:
query 0:
select count(*) as total from (traverse * from #14:22 while $depth <=2)
total=16
query 1:
select * from (traverse * from #14:22 while $depth <=2) where $depth=0
----+------+-------+----+----+-----
|@Rid |@Class |id |code|state
----+------+-------+----+----+-----
0 |#14:22|Brewery|23 |4103|Maine
----+------+-------+----+----+-----
query 2:
select * from (traverse * from #14:22 while $depth <=2) where $depth=1
----+---------+----------+--------+------
|@Rid |@Class |out |in
----+---------+----------+--------+------
0 |#17:888 |HasBrewery|#15:1437|#14:22
1 |#17:2552 |HasBrewery|#15:1437|#14:22
2 |#17:4216 |HasBrewery|#15:1437|#14:22
3 |#17:5880 |HasBrewery|#15:1437|#14:22
4 |#17:7544 |HasBrewery|#15:1437|#14:22
5 |#17:9208 |HasBrewery|#15:1437|#14:22
6 |#17:10872|HasBrewery|#15:1437|#14:22
7 |#17:12912|HasBrewery|#15:4269|#14:22
8 |#17:14276|HasBrewery|#15:5765|#14:22
9 |#17:15204|HasBrewery|#15:1437|#14:22
10 |#17:17244|HasBrewery|#15:4269|#14:22
11 |#17:18608|HasBrewery|#15:5765|#14:22
----+---------+----------+--------+------
query 3:
select * from (traverse * from #14:22 while $depth <=2) where $depth=2
----+--------+------+----+----+
|@Rid |@Class|id |abv |
----+--------+------+----+----+
0 |#15:1437|Beer |1438|0 |
1 |#15:4269|Beer |4282|5 |
2 |#15:5765|Beer |5840|8.3 |
----+--------+------+----+----+
from the query, seems the $depth are defined by count(E)+count(V). It does not fit with my personal common sense. Could you please clarify this?
The text was updated successfully, but these errors were encountered: