Package org.neo4j.graphdb.traversal

Examples of org.neo4j.graphdb.traversal.Traverser


    }

    @Test
    public void relationshipsIteratorReturnAllNodes() throws Exception
    {
        Traverser traverser = Traversal.description().traverse( referenceNode() );
        int count = 0;
        for ( Relationship relationship : traverser.relationships() )
        {
            assertNotNull(
                    "returned relationships should not be. relationship #"
                            + count, relationship );
            count++;
View Full Code Here


    }

    @Test
    public void pathsIteratorReturnAllNodes() throws Exception
    {
        Traverser traverser = Traversal.description().traverse( referenceNode() );
        int count = 0;
        for ( Path path : traverser )
        {
            assertNotNull( "returned paths should not be null. path #"
                           + count, path );
View Full Code Here

    }

    @Test
    public void testBreadthFirst() throws Exception
    {
        Traverser traverser = Traversal.description().breadthFirst().traverse(
                referenceNode() );
        Stack<Set<String>> levels = new Stack<Set<String>>();
        levels.push( new HashSet<String>( Arrays.asList( "5", "6", "7", "8",
                "9", "A", "B", "C", "D" ) ) );
        levels.push( new HashSet<String>( Arrays.asList( "2", "3", "4" ) ) );
View Full Code Here

    @Test
    public void testDepthFirstTraversalReturnsNodesOnCorrectDepths()
            throws Exception
    {
        Traverser traverser = Traversal.description().depthFirst().traverse(
                referenceNode() );
        int i = 0;
        for ( Path pos : traverser )
        {
            assertEquals( expectedDepth( i++ ), pos.length() );
View Full Code Here

    }

    @Test
    public void testPostorderDepthFirstReturnsDeeperNodesFirst()
    {
        Traverser traverser = Traversal.description().order(
                Traversal.postorderDepthFirst() ).traverse(
                        referenceNode() );
        int i = 0;
        List<String> encounteredNodes = new ArrayList<String>();
        for ( Path pos : traverser )
View Full Code Here

    }

    @Test
    public void testPostorderBreadthFirstReturnsDeeperNodesFirst()
    {
        Traverser traverser = Traversal.description().order(
                Traversal.postorderBreadthFirst() ).traverse( referenceNode() );
        Stack<Set<String>> levels = new Stack<Set<String>>();
        levels.push( new HashSet<String>( Arrays.asList( "1" ) ) );
        levels.push( new HashSet<String>( Arrays.asList( "2", "3", "4" ) ) );
        levels.push( new HashSet<String>( Arrays.asList( "5", "6", "7", "8",
View Full Code Here

        final TraversalDescription traversalDescription = new TraversalDescriptionImpl()
                .order(Traversal.postorderBreadthFirst())
                .prune(Traversal.pruneAfterDepth(MAXIMUM_DEPTH))
                .filter(calculateRatingPredicate)
                .relationships(DynamicRelationshipType.withName("friends"));
        final Traverser traverser = traversalDescription.traverse(userNode);
        final Iterator<Node> it = traverser.nodes().iterator();
        while (it.hasNext()) {
            it.next();
        }
        return calculateRatingPredicate.getRecommendedRestaurants(n);
    }
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.traversal.Traverser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.