[英]CosmosDB Gremlin API alternative for storing and processing Graph data
[英]Gremlin : Alternative for otherV in CosmosDB Gremlin API
我不想再次遍歷相同的頂點,但我無法在 CosmosDB Gremlin API 中使用 otherV。是否有替代方案?
您沒有使用示例,但有時我看到人們這樣做:
gremlin> g.V(1).bothE().otherV()
==>v[3]
==>v[2]
==>v[4]
這真的只是:
gremlin> g.V(1).both()
==>v[3]
==>v[2]
==>v[4]
后者更便宜。 在需要過濾邊緣的情況下,您只需要otherV()
:
gremlin> g.V(1).bothE().has('weight',gt(0.4)).otherV()
==>v[2]
==>v[4]
如果您遇到需要otherV()
的這種更合法的情況,您可以使用步驟 label 和where()
實現您自己的過濾器,例如:
gremlin> g.V(1).as('a').bothE().has('weight',gt(0.4)).union(inV(),outV()).where(neq('a'))
==>v[2]
==>v[4]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.