Gremlin: adding edges between nodes having the same property

后端 未结 1 395
面向向阳花
面向向阳花 2021-01-21 16:09


I am very new to Gremlin. I am trying to build a graph on DSE graph using Gremlin. I am able to create the vertices:

a = graph.addVertex(label, \'label1\',          


        
1条回答
  •  说谎
    说谎 (楼主)
    2021-01-21 16:45

    Nested g.V()'s are usually a bad idea. You can solve the problem using a single traversal:

    g.V().hasLabel("label1").as("a").
      V().hasLabel("label2").as("b").
      where("a", eq("b")).by("key").
      addE("link").from("a").to("b")
    

    Also note that you'll have to allow scans in DSE Graph to make this traversal work.

    0 讨论(0)
提交回复
热议问题