如果您能就单个gremlin查询提供建议,我将不胜感激,该查询将为我提供所有节点的列表以及每个节点的特定连接类型的计数。
答案 0 :(得分:0)
如果您尝试获取每个节点的所有边缘并按节点分组,那么应该这样做:
gremlin> graph = TinkerFactory.createModern();
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal();
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.E().group().by(inV());
==>[v[2]:[e[7][1-knows->2]],v[3]:[e[9][1-created->3],e[11][4-created->3],e[12][6-created->3]],v[4]:[e[8][1-knows->4]],v[5]:[e[10][4-created->5]]]
答案 1 :(得分:0)
如果您指的是所有事件边缘的标签数量:
gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().project("v","labels").by().by(bothE().groupCount().by(label))
==>[v:v[1],labels:[created:1,knows:2]]
==>[v:v[2],labels:[knows:1]]
==>[v:v[3],labels:[created:3]]
==>[v:v[4],labels:[created:2,knows:1]]
==>[v:v[5],labels:[created:1]]
==>[v:v[6],labels:[created:1]]