Package org.neo4j.graphalgo.impl.path

Examples of org.neo4j.graphalgo.impl.path.ShortestPath


     *            to have.
     * @return an algorithm which finds shortest paths between two nodes.
     */
    public static PathFinder<Path> shortestPath( RelationshipExpander expander, int maxDepth )
    {
        return new ShortestPath( maxDepth, expander );
    }
View Full Code Here


     * paths were found.
     * @return an algorithm which finds paths of a certain length between two nodes.
     */
    public static PathFinder<Path> pathsWithLength( RelationshipExpander expander, int length )
    {
        return new ShortestPath( length, expander, true );
    }
View Full Code Here

        Node a = graph.getNode( "a" );
        Node b = graph.getNode( "b" );
        Node c = graph.getNode( "c" );
        final Set<Node> allowedNodes = new HashSet<Node>( Arrays.asList( a, b, c ) );
       
        PathFinder<Path> finder = new ShortestPath( 100, Traversal.expanderForAllTypes( Direction.OUTGOING ) )
        {
            @Override
            protected Collection<Node> filterNextLevelNodes( Collection<Node> nextNodes )
            {
                for ( Node node : nextNodes )
                {
                    if ( !allowedNodes.contains( node ) )
                    {
                        fail( "Node " + node.getProperty( KEY_ID ) + " shouldn't be expanded" );
                    }
                }
                return nextNodes;
            }
        };
        finder.findAllPaths( a, c );
    }
View Full Code Here

TOP

Related Classes of org.neo4j.graphalgo.impl.path.ShortestPath

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.