我正在尝试从头开始创建一个在 graphexp 中可视化的图表,但我正在努力理解匿名遍历的概念以及如何创建它们
我正在使用 python 3.9 和 gremlinpython 3.5.1
from gremlin_python.process.anonymous_traversal import traversal
self.g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin', 'g'))
Run Code Online (Sandbox Code Playgroud)
statics.load_statics(globals())
Run Code Online (Sandbox Code Playgroud)
def _add_vertex(self, name):
return self.g.V().has('name', name).fold().coalesce(unfold(), addV().property('name',name)).next()
Run Code Online (Sandbox Code Playgroud)
def _add_edge(self, v1, v2, weight, label):
return self.g.V(v1).as_("fromVertex").V(v2).coalesce(inE(label).where(outV().as_(
"fromVertex")), addE(label).property("weight", weight).from_("fromVertex")).next()
Run Code Online (Sandbox Code Playgroud)
但是当我点击一个顶点时,我在 graphexp 中遇到了这个错误
Error retrieving data
The child traversal of [GraphStep(vertex,[696560]), PropertyMapStep(value)] was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal
Run Code Online (Sandbox Code Playgroud)
该文档总体不错,但对于匿名遍历部分没有太大帮助。那么如何使用这种方法生成匿名子遍历呢?它的真正含义是什么?