使用 Gremlin 在图数据库中查找图的深度
To find the depth of the Graph in Graph Database using Gremlin
给定一个有 V 个顶点和 E 个边的有向图。我们如何使用 Gremlin 命令获取图形的高度?假设每条边都有一个值 "knows"。
The sample graph is given here.。
查看丹尼尔对另一个问题的回答:
Print hierarchical vertices in a graph
即如果你想从顶点 42 开始,使用:
g.V(42).emit().repeat(out('knows').dedup()).count()
如果您想从给定 属性 的顶点开始,例如'name' 是 'HEART94',然后指定它,即:
g.V().has('name','HEART94').emit().repeat(out('knows').dedup()).count()
希望对您有所帮助,
格雷厄姆
给定一个有 V 个顶点和 E 个边的有向图。我们如何使用 Gremlin 命令获取图形的高度?假设每条边都有一个值 "knows"。 The sample graph is given here.。
查看丹尼尔对另一个问题的回答:
Print hierarchical vertices in a graph
即如果你想从顶点 42 开始,使用:
g.V(42).emit().repeat(out('knows').dedup()).count()
如果您想从给定 属性 的顶点开始,例如'name' 是 'HEART94',然后指定它,即:
g.V().has('name','HEART94').emit().repeat(out('knows').dedup()).count()
希望对您有所帮助, 格雷厄姆