Getting vertices that are connected to ALL current vertices

前端 未结 1 1881
抹茶落季
抹茶落季 2021-01-29 10:04

I might be asking an obvious question, but new to the graphs and gremlin language and got a bit stuck.

I have a graph setup where I can find N vertices of a particular

1条回答
  •  抹茶落季
    2021-01-29 11:02

    Aggregate all source vertices in a collection named x, then traverse to all y vertices and verify that each y vertex has n number of edges leading to vertices stored in x (where n equals the size of x).

    gremlin> g.V().hasLabel("X1","X2").aggregate("x").
               in("isOf").dedup().
               filter(out("isOf").where(within("x")).count().
                      where(eq("x")).
                        by().
                        by(count(local))).
               valueMap()
    ==>[name:[y1]]
    ==>[name:[y2]]
    

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