Java GremlinPipeline使用Titan和OrientDB返回不同的结果
我正在使用以下代码尝试使用Java GremlinPipeline使用Titan和OrientDB返回不同的结果,java,shortest-path,gremlin,orientdb,titan,Java,Shortest Path,Gremlin,Orientdb,Titan,我正在使用以下代码尝试使用GremlinPipeline查找最短路径: final GremlinPipeline<String, List> pathPipe = new GremlinPipeline<String, List>(v1) .as("similar") .both("similar") .loop("similar", new PipeFunction<LoopBundle&l
GremlinPipeline
查找最短路径:
final GremlinPipeline<String, List> pathPipe = new GremlinPipeline<String, List>(v1)
.as("similar")
.both("similar")
.loop("similar", new PipeFunction<LoopBundle<Vertex>, Boolean>() {
//@Override
public Boolean compute(LoopBundle<Vertex> bundle) {
return bundle.getLoops() < 5 && bundle.getObject() != v2;
}
})
.path();
Iterator iter = pathPipe.iterator();
while(iter.hasNext()) {
System.out.println(iter.next());
}
(4是v1的id,8是节点2的id)
但是当我将上面的代码用于orientDB数据时,我得到了不同的结果,例如
[v[#9:0], v[#9:0], v[#9:0]]
[v[#9:0], v[#9:0], v[#9:1]]
[v[#9:0], v[#9:0], v[#9:45]]
[v[#9:0], v[#9:0], v[#9:55]]
(#9:0是v1的id,#9:1是v2的id)
请注意,我使用以下代码打印结果:
final GremlinPipeline<String, List> pathPipe = new GremlinPipeline<String, List>(v1)
.as("similar")
.both("similar")
.loop("similar", new PipeFunction<LoopBundle<Vertex>, Boolean>() {
//@Override
public Boolean compute(LoopBundle<Vertex> bundle) {
return bundle.getLoops() < 5 && bundle.getObject() != v2;
}
})
.path();
Iterator iter = pathPipe.iterator();
while(iter.hasNext()) {
System.out.println(iter.next());
}
编辑:我使用orientdb-1.6.1、titan 0.4.1、blueprints-core-2.5.0和blueprints-orient-graph-2.5.0您能报告blueprints和orientdb版本吗?我建议在NonTx中运行,以查看错误是否相同。只需使用OrientGraphNoTx。我使用了OrientGraphNoTx,但输出是相同的。你知道哪个结果是正确的吗?(或者这两个结果都是可能的答案?)