gremlin query to retrieve vertices which are having multiple edges between them

Viewed 4090

enter image description here

Consider the above graph. I would like a gremlin query that returns all nodes that have multiple edges between them as shown in the graph.

this graph was obtained using neo4j cypher query: MATCH (d:dest)-[r]-(n:cust) WITH d,n, count(r) as popular RETURN d, n ORDER BY popular desc LIMIT 5

for example: between RITUPRAKA... and Asia there are 8 multiple edges hence the query has returned the 2 nodes along with the edges, similarly for other nodes.

Note: the graph has other nodes with only a single edge between them, these nodes will not be returned.

I would like same thing in gremlin.

I have used given below query g.V().as('out').out().as('in').select('out','in').groupCount().unfold().filter(select(values).is(gt(1))).select(keys)

it is displaying out:v[1234],in:v[3456] .....

but instead of displaying Ids of the node I want to display values of the node like out:ICIC1234,in:HDFC234

I have modified query as g.V().values("name").as('out').out().as('in').values("name").select('out','in'). groupCount().unfold().filter(select(values).is(gt(1))).select(keys)

but it is showing the error like classcastException, each vertex to be traversed use indexes for fast iteration

2 Answers
Related