| 2 | import java.util.PriorityQueue; |
| 3 | |
| 4 | public class DijkstraTest { |
| 5 | |
| 6 | static int[][] weights = { |
| 7 | {1, 2, 7}, |
| 8 | {1, 3, 5}, |
| 9 | {1, 4, 3}, |
| 10 | {3, 4, 3}, |
| 11 | {3, 5, 3}, |
| 12 | {4, 5, 9}, |
| 13 | {4, 7, 7}, |
| 14 | {5, 3, 2}, |
| 15 | {5, 7, 1}, |
| 16 | {6, 2, 3}, |
| 17 | {6, 4, 1}, |
| 18 | {6, 7, 7} |
| 19 | }; |
| 20 | |
| 21 | public static void main(String[] args) { |
| 22 | /* Simple Dijkstra */ |
| 23 | Dijkstra d = new Dijkstra(7); |
| 24 | for (int[] w : weights) d.setGraph(w[0], w[1], w[2]); |
| 25 | // d.printGraph(); |
| 26 | d.getShortestDistance(1); |
| 27 | |
| 28 | /* Improved Dijkstra */ |
| 29 | ImprovedDijkstra d2 = new ImprovedDijkstra(7); |
| 30 | for (int[] w : weights) d2.setGraph(w[0], w[1], w[2]); |
| 31 | // d2.printGraph(); |
| 32 | d2.getShortestDistance(1); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | class Dijkstra { |
| 37 | private int N; |
nothing calls this directly
no outgoing calls
no test coverage detected