I'm trying to simply compute the shortest path between 2 nodes labelled "Person".
final Vertex startnode = graphDb.traversal().V().hasLabel("Person").has("name", 5).next();
final Vertex endNode = graphDb.traversal().V().hasLabel("Person").has("name", 6).next();
//Computing
final GremlinPipeline pipe = new GremlinPipeline(startnode).as("node")
.outE("knows").loop("node", new PipeFunction<LoopBundle<Vertex>, Boolean>() {
@Override
public Boolean compute(LoopBundle<Vertex> bundle) {
return bundle.getLoops() < 10 && bundle.getObject() != endNode;
}
}).path();
//Showing the result
if (pipe.hasNext()) { //Error at this line
final ArrayList<CacheVertex> shortestPath = (ArrayList<Vertex>) pipe.next();
for (final Vertex v : shortestPath) {
System.out.print(" -> " + v.property("name"));
}
System.out.println();
}
But I got the error : com.thinkaurelius.titan.graphdb.vertices.CacheVertex cannot be cast to com.tinkerpop.blueprints.Vertex