Suppose I have a graph looks like below
graph = TinkerGraph.open()
g = graph.traversal()
v1 = g.addV('CC').property('name','t1')
v2 = g.addV('KK').property('name','t1')
I want to find all CC which has the same 'name' as KK. I can write:
g.V().hasLabel('CC').as('c').values('name').as('cn').V().hasLabel('KK').values('name').as('k').where('cn',eq('k')).select('c')
This mimics the join in SQL but writing so the performance seems very bad. From SQL2Gremlin, they have example of "join" two nodes if there is an edge connected between two. I was wondering if there is any join approach in gremlin that whether there is a path connected two nodes is unknown beforehand? In other words, what's the best approach to write "join" in gremlin and we don't know whether such two nodes are connected or not either directly or via a path?
Thanks much!