Gremlin,如何在gremlin-python中为现有顶点添加边 [英] Gremlin, How to add edge to existing vertex in gremlin-python

查看:255
本文介绍了Gremlin,如何在gremlin-python中为现有顶点添加边的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将边缘添加到gremlin-python中的现有节点.但是图形遍历(g)对象没有addE方法,而顶点没有addEdge方法.

I am trying to add edge to an existing node in gremlin-python. But graph traversal(g) object do not have addE method and vertex do not have addEdge method.

推荐答案

您可以使用遍历V()来做到这一点:

You can do it with a mid-traversal V():

>>> vFrom = g.V(1).next()
>>> vTo = g.V(6).next()
>>> g.V(vTo).as_('t').V(vFrom).addE("knows").to("t").toList()
[e[13][1-knows->6]]

我确实了解到,有一个错误阻止了TinkerPop 3.2.4中使用withSideEffect()的这种方法:

I did learn that there is a bug that prevents this approach that uses withSideEffect() in TinkerPop 3.2.4:

>>> g.withSideEffect("t",vTo).V(vFrom).addE("knows").to("t").toList()

我创建了一个问题以帮助跟踪该错误.

I created an issue to help track the bug.

这篇关于Gremlin,如何在gremlin-python中为现有顶点添加边的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆