我有一个带有功能的用户的 gremlin 图。图的边缘从用户那里出去并进入特征。用户没有传入边,特征也没有传出边。每个用户顶点都有许多输出边到特征顶点。
我想找到连接到顶点的女性用户子feature_a
集feature_b
。我正在使用gremlinpython
并且我知道我可以使用下面的代码在 python 中进行某种设置交集。gremlin 有没有办法做到这一点?
q = '''g.V('feature_a').
inv().has('gender','Female')'''
res1 = client.submit(q).all().result()
q2 = '''g.V('feature_b').
inv().has('gender','Female')'''
res2 = client.submit(q2).all().result()
vs_in_common = set(res2).intersection(set(res1)))