简体   繁体   English

Gremlin-Python:将遍历从边切换为顶点

[英]Gremlin-Python: Switch traversal from edges to vertices

I want to perform a centrality calculation : 我要执行集中度计算

g.V().repeat(groupCount('m').by('name').out()).times(5).cap('m')

using only a subset of edges: 仅使用边缘的子集:

g.E().has('some-property', 'some-value')

Unfortunately, the .subgraph() step returns a dict in gremlin-python, so I can't use it to perform further traversals. 不幸的是, .subgraph()步骤在gremlin-python中返回了一个dict ,所以我不能用它来执行进一步的遍历。

Is there another way to combine an edge-oriented traversal with a vertex-oriented one? 还有另一种方法可以将边沿遍历与顶点遍历相结合?

Just apply some filter to your edges: 只需对边缘应用一些滤镜:

g.V().
  repeat(groupCount('m').
           by('name').
         outE().has(....).inV()).
    times(5).
  cap('m')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM