Package ch.akuhn.graph

Examples of ch.akuhn.graph.DijkstraAlgorithm2


        }
    }
   
    public void computeShortestPathWithDijkstra() {
        Graph g = new Graph(graph);
        DijkstraAlgorithm2 dijsktra = new DijkstraAlgorithm2();
        for (int i = 0; i < n; i++) {
            /* NB: it is safe to update graph and use it for distances
             * in the same time since we only lookup the distances of
             * directly connected nodes, which are not updated.
             */
            double[] cost = dijsktra.apply(g, g.nodes[i], graph);
            for (int j = 0; j < n; j++) graph.put(i,j, cost[j]);
        }
    }
View Full Code Here

TOP

Related Classes of ch.akuhn.graph.DijkstraAlgorithm2

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.