I'm trying to write a Gremlin loop that returns something like the following for a vertex:
nodeId:1, edgeCount: 2
nodeId:2, edgeCount: 1
nodeId:3, edgeCount: 3
nodeId:4, edgeCount: 4
In other words, a list of its neighbors' ids along with each neighbor's edge count. The closest I've got is this (for the vertex 'svpol'):
g.v('svpol').in.loop(1){it.loops<2}.path{it.id}{g.v(it.id).bothE.count()}
which produces the following output:
==>[svpol, 2]
==>[svpol, 4]
==>[svpol, 4]
==>[svpol, 6]
I have confirmed that the edge counts are correct, but instead of 'svpol' I would want it to produce the id of the neighbor. It needs to be done in a single query if possible.
Any ideas?