Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Path.relationships()


                    IndexedRelationship.RELATIONSHIP_DIRECTION );
                try
                {
                    IndexedRelationship indexedRelationship = new IndexedRelationship( path.endNode(), relType,
                        Direction.valueOf( direction ) );
                    return indexedRelationship.getRelationship( path.relationships().iterator().next() );
                }
                catch ( Exception e )
                {
                    throw new RuntimeException( "Comparator class cannot be instantiated" );
                }
View Full Code Here



        PathFinder<WeightedPath> finder = GraphAlgoFactory.aStar(relExpander, costEval, estimateEval);

        Path route = finder.findSinglePath(startNode, endNode);
        return getPathGeometries(route.relationships());
    }


    private List<LineString> getPathGeometries(Iterable<Relationship> relationships) {
        List<LineString> result = new ArrayList<LineString>();
View Full Code Here

            }

            Iterator<Relationship> thisPathIterator =
                    this.relationships().iterator();
            Iterator<Relationship> thatPathIterator =
                    other.relationships().iterator();
            while ( thisPathIterator.hasNext() && thatPathIterator.hasNext() )
            {
                if ( thisPathIterator.hasNext() != thatPathIterator.hasNext() )
                {
                    return false;
View Full Code Here

                    "The nodes of the head and tail must match" );
        }
        Path headPath = source.position(), tailPath = target.position();
        Relationship[] relationships = new Relationship[headPath.length()
                                                        + tailPath.length()];
        Iterator<Relationship> iter = headPath.relationships().iterator();
        for ( int i = 0; iter.hasNext(); i++ )
        {
            relationships[i] = iter.next();
        }
        iter = tailPath.relationships().iterator();
View Full Code Here

        {
            Path other = (Path) obj;
            if ( startNode().equals( other.startNode() ) )
            {
                Iterator<Relationship> these = relationships().iterator();
                Iterator<Relationship> those = other.relationships().iterator();
                while ( these.hasNext() && those.hasNext() )
                {
                    if ( !these.next().equals( those.next() ) )
                    {
                        return false;
View Full Code Here

        {
            assertTrue( "expected more paths (found: " + foundCount + ")", paths.hasNext() );
            Path path = paths.next();
            assertPath( path, nodeA, nodeB, nodeC );

            Iterator<Relationship> relationships = path.relationships().iterator();
            assertTrue( "found shorter path than expected",
                    relationships.hasNext() );
            assertTrue( "path contained unexpected relationship",
                    expectedFirsts.remove( relationships.next() ) );
            assertTrue( "found shorter path than expected",
View Full Code Here

        {
            assertTrue( "expected more paths", paths.hasNext() );
            Path path = paths.next();
            assertPath( path, nodeA, nodeB, nodeC );

            Iterator<Relationship> relationships = path.relationships().iterator();
            assertTrue( "found shorter path than expected",
                    relationships.hasNext() );
            assertTrue( "path contained unexpected relationship",
                    expectedFirsts.remove( relationships.next() ) );
            assertTrue( "found shorter path than expected",
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.