No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DijkstraAlgorithm.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package org.insa.graphs.algorithm.shortestpath;
  2. import java.util.ArrayList;
  3. import java.util.Arrays;
  4. import java.util.Collections;
  5. import java.util.Iterator;
  6. import org.insa.graphs.model.Arc;
  7. import org.insa.graphs.model.Graph;
  8. import org.insa.algo.AbstractSolution.Status;
  9. import org.insa.algo.utils.*;
  10. import org.insa.graph.*;
  11. public class DijkstraAlgorithm extends ShortestPathAlgorithm {
  12. public DijkstraAlgorithm(ShortestPathData data) {
  13. super(data);
  14. }
  15. @Override
  16. protected ShortestPathSolution doRun() {
  17. ShortestPathSolution solution = null;
  18. // Initialisation
  19. // du graphe
  20. final ShortestPathData data = getInputData();
  21. Graph graph = data.getGraph();
  22. final int nbNodes = graph.size();
  23. // des couts
  24. double[] distances = new double[nbNodes];
  25. Arrays.fill(distances, Double.POSITIVE_INFINITY);
  26. distances[data.getOrigin().getId()] = 0;
  27. // Notify observers about the first event (origin processed).
  28. notifyOriginProcessed(data.getOrigin());
  29. // Initialize array of predecessors.
  30. Arc[] predecessorArcs = new Arc[nbNodes];
  31. while (solution == null) { //Tant qu'il y a pas de solution
  32. }
  33. // TODO:
  34. return solution;
  35. }
  36. }