use of org.neo4j.graphdb.traversal.Traverser in project neo4j by neo4j.
the class TreeGraphTest method testPostorderBreadthFirstReturnsDeeperNodesFirst.
@Test
public void testPostorderBreadthFirstReturnsDeeperNodesFirst() {
Traverser traverser = getGraphDb().traversalDescription().order(POSTORDER_BREADTH_FIRST).traverse(node("1"));
Stack<Set<String>> levels = new Stack<>();
levels.push(new HashSet<>(asList("1")));
levels.push(new HashSet<>(asList("2", "3", "4")));
levels.push(new HashSet<>(asList("5", "6", "7", "8", "9", "A", "B", "C", "D")));
try (Transaction tx = beginTx()) {
assertLevels(traverser, levels);
tx.success();
}
}
use of org.neo4j.graphdb.traversal.Traverser in project neo4j by neo4j.
the class DepthPitfallGraphTest method testAllUniqueNodePathsAreReturned.
private void testAllUniqueNodePathsAreReturned(TraversalDescription description) throws Exception {
Traverser traverser = description.uniqueness(Uniqueness.NODE_PATH).traverse(node("1"));
expectPaths(traverser, NODE_UNIQUE_PATHS);
}
use of org.neo4j.graphdb.traversal.Traverser in project neo4j by neo4j.
the class DepthPitfallGraphTest method testAllRelationshipsAreReturnedOnce.
private void testAllRelationshipsAreReturnedOnce(TraversalDescription description) throws Exception {
Traverser traverser = getGraphDb().traversalDescription().uniqueness(Uniqueness.RELATIONSHIP_GLOBAL).traverse(node("1"));
expectRelationships(traverser, THE_WORLD_AS_WE_KNOW_IT);
}
use of org.neo4j.graphdb.traversal.Traverser in project neo4j by neo4j.
the class PagedTraverserTest method shouldPageThroughResultsForWhollyDivisiblePageSize.
@Test
public void shouldPageThroughResultsForWhollyDivisiblePageSize() {
Traverser myTraverser = simpleListTraverser();
PagedTraverser traversalPager = new PagedTraverser(myTraverser, LIST_LENGTH / 10);
int iterations = iterateThroughPagedTraverser(traversalPager);
assertEquals(10, iterations);
assertNull(traversalPager.next());
}
Aggregations