Gremlin: What's an efficient way of finding an edge between two vertices?

前端 未结 2 1933
傲寒
傲寒 2021-01-13 04:44

So obviously, a straight forward way to find an edge between two vertices is to:

graph.traversal().V(outVertex).bothE(edgeLabel).filter(__.otherV().is(inVert         


        
2条回答
  •  有刺的猬
    2021-01-13 05:02

    In case one does not know the vertex Id's, another solution might be

    g.V().has('propertykey','value1').outE('thatlabel').as('e').inV().has('propertykey','value2').select('e')
    

    This is also only unidirectional so one needs to reformulate the query for the opposite direction.

提交回复
热议问题