Azure cosmosdb Gremlin:CosmosDB Gremlin API中otherV的替代方案

Azure cosmosdb Gremlin:CosmosDB Gremlin API中otherV的替代方案,azure-cosmosdb,gremlin,gremlin-server,azure-cosmosdb-gremlinapi,Azure Cosmosdb,Gremlin,Gremlin Server,Azure Cosmosdb Gremlinapi,我不希望再次遍历同一个顶点,但我无法在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(): g

我不希望再次遍历同一个顶点,但我无法在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()
,您可以使用步骤标签和
where()
实现自己的过滤器,如:

gremlin> g.V(1).as('a').bothE().has('weight',gt(0.4)).union(inV(),outV()).where(neq('a'))
==>v[2]
==>v[4]

您没有使用示例,但有时我看到人们这样做:

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()
,您可以使用步骤标签和
where()
实现自己的过滤器,如:

gremlin> g.V(1).as('a').bothE().has('weight',gt(0.4)).union(inV(),outV()).where(neq('a'))
==>v[2]
==>v[4]