MCPcopy Create free account
hub / github.com/Seogeurim/CS-study / DijkstraTest

Class DijkstraTest

contents/algorithm/code/DijkstraTest.java:4–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import java.util.PriorityQueue;
3
4public 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
36class Dijkstra {
37 private int N;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected