If there are multiple edges connecting the same pair of nodes, both will come back with duplicated nodes:
gremlin> v2 = g.addVertex(null,['x':5,'y':7])
==>v[360004]
gremlin> v3 = g.addVertex(null, ['x':2,'y':3])
==>v[360008]
gremlin> g.addEdge(v2,v3,'test')
==>e[6IeZ-1vEw-2F0LaTPQQu][360004-test->360008]
gremlin> g.addEdge(v2,v3,'test 2')
==>e[6If7-1vEw-2F0LaTPQQC][360004-test 2->360008]
gremlin> v2.both.map
==>{y=3, x=2}
==>{y=3, x=2}
How can ensure that I get back a distinct list of nodes?
dedup makes this easy and is explained in the Gremlin docs. For the example above:
gremlin> v2.both.dedup.map
==>{y=3, x=2}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With