Examples of Dijkstra


Examples of dijkstra.Dijkstra

    maze.clear();
    DBox depart = maze.getD();
    if( depart != null){


      Dijkstra dijkstraObjet = new Dijkstra();
      ArrayList<VertexInterface> chemin = null;

      chemin = dijkstraObjet.dijkstra((GraphInterface)maze, depart).getShortestPathsTo(this.maze.getA());

      if(chemin.size() == 0) { // Pas de chemin : on affiche une boite de dialogue
        JOptionPane.showMessageDialog(null, "Le labyrinthe n'a pas de chemin solution", "Pas de chemin", JOptionPane.INFORMATION_MESSAGE);

      } else {
View Full Code Here

Examples of ie.transportdublin.graphalgo.Dijkstra

    {
        Node start = setupStart( lat1, lon1, time );
        Node end = setupEnd( lat2, lon2 );
        RelationshipType lat2lon2 = DynamicRelationshipType.withName( lat2.toString() + lon2.toString() );
        WaitingTimeCostEvaluator eval = new WaitingTimeCostEvaluator(Connection.COST, lat2lon2);
        Dijkstra dijkstra = new Dijkstra( expander, eval, time );
        return dijkstra.findSinglePath( start, end );
    }
View Full Code Here

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

     * using the Dijkstra algorithm.
     */
    public static PathFinder<WeightedPath> dijkstra( RelationshipExpander expander,
            CostEvaluator<Double> costEvaluator )
    {
        return new Dijkstra( expander, costEvaluator );
    }
View Full Code Here

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

        Node nodeC = graph.makeNode( "C" );
        graph.makeEdge( "A", "B", "length", 2d );
        graph.makeEdge( "B", "C", "length", 3d );
        graph.makeEdge( "A", "C", "length", 10d );

        Dijkstra algo = new Dijkstra( Traversal.expanderForAllTypes(),
                CommonEvaluators.doubleCostEvaluator( "length" ) );

        Iterator<WeightedPath> paths = algo.findAllPaths( nodeA, nodeC ).iterator();
        assertTrue( "expected at least one path", paths.hasNext() );
        assertPath( paths.next(), nodeA, nodeB, nodeC );
        assertFalse( "expected at most one path", paths.hasNext() );

        assertPath( algo.findSinglePath( nodeA, nodeC ), nodeA, nodeB, nodeC );
    }
View Full Code Here

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

        expectedFirsts.add( graph.makeEdge( "A", "B", "length", 1d ) );
        expectedFirsts.add( graph.makeEdge( "A", "B", "length", 1d ) );
        Relationship expectedSecond = graph.makeEdge( "B", "C", "length", 2d );
        graph.makeEdge( "A", "C", "length", 5d );

        Dijkstra algo = new Dijkstra( Traversal.expanderForAllTypes(),
                CommonEvaluators.doubleCostEvaluator( "length" ) );

        Iterator<WeightedPath> paths = algo.findAllPaths( nodeA, nodeC ).iterator();
        for ( int i = 0; i < 2; i++ )
        {
            assertTrue( "expected more paths", paths.hasNext() );
            Path path = paths.next();
            assertPath( path, nodeA, nodeB, nodeC );
View Full Code Here

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

        graph.makeEdge( "C", "E", "length", 5d );
        graph.makeEdge( "E", "F", "length", 5d );
        graph.makeEdge( "C", "F", "length", 12d );
        graph.makeEdge( "A", "F", "length", 25d );

        Dijkstra algo = new Dijkstra( Traversal.expanderForAllTypes(),
                CommonEvaluators.doubleCostEvaluator( "length" ) );

        // Try the search in both directions.
        for ( Node[] nodes : new Node[][] { { nodeA, nodeF }, { nodeF, nodeA } } )
        {
            int found = 0;
            Iterator<WeightedPath> paths = algo.findAllPaths( nodes[0],
                    nodes[1] ).iterator();
            for ( int i = 0; i < 2; i++ )
            {
                assertTrue( "expected more paths", paths.hasNext() );
                Path path = paths.next();
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.