从外部 json 文件导入新顶点
Import of new vertex from external json file
此代码是仅导入顶点 json 还是导入顶点并将其添加到图
graph.io(GraphSONIo.build()).reader().create().readVertex(new FileInputStream("/tmp/Vertex.json"),null)
这只会导入顶点,但不会将其添加到图形中,因为 readVertex
方法签名是这样的
Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>, Vertex> vertexAttachMethod)
因此您需要使用 graph
对象作为来源提供给 Function<Attachable<Vertex>, Vertex> vertexAttachMethod
以便它读取并添加到您的图表中。
此代码是仅导入顶点 json 还是导入顶点并将其添加到图
graph.io(GraphSONIo.build()).reader().create().readVertex(new FileInputStream("/tmp/Vertex.json"),null)
这只会导入顶点,但不会将其添加到图形中,因为 readVertex
方法签名是这样的
Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>, Vertex> vertexAttachMethod)
因此您需要使用 graph
对象作为来源提供给 Function<Attachable<Vertex>, Vertex> vertexAttachMethod
以便它读取并添加到您的图表中。