diff --git a/src/dijkstra/Dijkstra.java b/src/dijkstra/Dijkstra.java index 7bf41f5..e69f0a6 100644 --- a/src/dijkstra/Dijkstra.java +++ b/src/dijkstra/Dijkstra.java @@ -1,9 +1,13 @@ package dijkstra; import java.util.ArrayList; +import java.util.HashSet; +import java.util.Hashtable; + +import maze.Box; public class Dijkstra { - private PreviousInterface dijkstra(GraphInterface g, VertexInterface r, ASetInterface a, PiInterface pi, PreviousInterface previous) { + private static PreviousInterface dijkstra(GraphInterface g, VertexInterface r, ASetInterface a, PiInterface pi, PreviousInterface previous) { a.add(r) ; ; VertexInterface pivot = r ; @@ -42,5 +46,21 @@ public class Dijkstra { } + public static PreviousInterface dijkstra(GraphInterface g, VertexInterface r) { + + HashSet vertexHashSet = new HashSet() ; + ASet aSet = new ASet(vertexHashSet) ; + + Hashtable hashPi = new Hashtable() ; + Pi pi = new Pi(hashPi) ; + + Hashtable hashPrevious = new Hashtable() ; + ArrayList shortestPath = new ArrayList() ; + Previous previous = new Previous(hashPrevious, shortestPath) ; + + return dijkstra(g, r, aSet, pi, previous) ; + + + } } diff --git a/src/dijkstra/Pi.java b/src/dijkstra/Pi.java index b36c4d2..6cd3c7d 100644 --- a/src/dijkstra/Pi.java +++ b/src/dijkstra/Pi.java @@ -6,6 +6,12 @@ public class Pi implements PiInterface { private Hashtable hashPi = new Hashtable() ; + public Pi(Hashtable hashPi) { + + this.hashPi = hashPi ; + + } + public int getPi(VertexInterface vertex) { return hashPi.get(vertex) ; diff --git a/src/dijkstra/Previous.java b/src/dijkstra/Previous.java index 6526365..cc1637a 100644 --- a/src/dijkstra/Previous.java +++ b/src/dijkstra/Previous.java @@ -7,6 +7,14 @@ public class Previous implements PreviousInterface { private Hashtable hashPrevious = new Hashtable() ; private ArrayList shortestPath = new ArrayList() ; + + + + public Previous(Hashtable hashPrevious, ArrayList shortestPath) { + super(); + this.hashPrevious = hashPrevious; + this.shortestPath = shortestPath; + } public VertexInterface getPrevious(VertexInterface vertex) {