简体   繁体   English

Gremlin 反向遍历

[英]Gremlin reverse traversal

In a Gremlin graphdb I have something like:在 Gremlin graphdb 中,我有类似的东西:

root
   level1
      level2
        levelN

If I know 'root' I can find 'levelN' using the following query:如果我知道'root',我可以使用以下查询找到'levelN':

g.v().has('name','root').repeat(out().simplePath()).until(has('name','levelN'))

but how do I go the other way, given I know 'levelN', how do I find 'root' it doesn't seem to be possible to do:但是我该怎么做 go,因为我知道'levelN',我如何找到'root',这似乎是不可能的:

g.v().has('name','levelN').repeat(in().simplePath()).until(has('name','root'))

TIA TIA

/Søren /索伦

Depending on the client language you are using, in is a reserved word and should be written as __.in() or in_() .根据您使用的客户端语言, in是保留字,应写为__.in()in_()

Check Vertex Steps in the TinkerPop documentation for more information: http://tinkerpop.apache.org/docs/current/reference/#vertex-steps检查 TinkerPop 文档中的顶点步骤以获取更多信息: http://tinkerpop.apache.org/docs/current/reference/#vertex-steps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM