use of org.neo4j.graphdb.traversal.Uniqueness.NODE_PATH in project neo4j by neo4j.
the class TestBidirectionalTraversal method mirroredTraversalReversesInitialState.
@Test
void mirroredTraversalReversesInitialState() {
/*
* (a)-->(b)-->(c)-->(d)
*/
createGraph("a TO b", "b TO c", "c TO d");
try (Transaction transaction = getGraphDb().beginTx()) {
BranchCollisionPolicy collisionPolicy = (evaluator, pathPredicate) -> new StandardBranchCollisionDetector(null, null) {
@Override
protected boolean includePath(Path path, TraversalBranch startPath, TraversalBranch endPath) {
assertEquals(0, startPath.state());
assertEquals(10, endPath.state());
return true;
}
};
Iterables.count(transaction.bidirectionalTraversalDescription().mirroredSides(transaction.traversalDescription().uniqueness(NODE_PATH).expand(PathExpanders.forType(to), new InitialBranchState.State<>(0, 10))).collisionPolicy(collisionPolicy).traverse(getNodeWithName(transaction, "a"), getNodeWithName(transaction, "d")));
}
}
Aggregations