3

如果有多个边连接同一对节点,both将返回重复节点:

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}

如何确保我得到一个不同的节点列表?

4

1 回答 1

5

dedup使这很容易,并在Gremlin 文档中进行了解释。对于上面的例子:

gremlin> v2.both.dedup.map
==>{y=3, x=2}
于 2013-06-14T23:26:41.363 回答