简体   繁体   中英

How to get all vertices of all incoming/outgoing edges from a vertex scala gremlin

I have a vertex A -> B . I have multiple outgoing/incoming edges created between these two edges with same label.

When i query to get the neighbour vertex ,it is giving me duplicate vertex for each edges it has to the other vertex.

example :

gremlin> graph.traversal().V().has('ID', 'a').both("interference")
==>v[2]
==>v[2]
==>v[2]
==>v[2]
==>v[2]
==>v[2]

http://gremlinbin.com/bin/view/58087f51ba0d5

I do not need the duplicate vertex if it has multiple edges .

That's what the dedup() step is for:

gremlin> graph.traversal().V().has('ID', 'a').both("interference").dedup()
==>v[2]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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