Commit ccead898 authored by trh010's avatar trh010
Browse files

progress made

parent 0ed24ba7
...@@ -97,4 +97,31 @@ public class AdjacencyList { ...@@ -97,4 +97,31 @@ public class AdjacencyList {
} }
return out.toString(); return out.toString();
} }
private void buildDijkstraGraph(int startingVertex){
//Initialize graph
Vertex temp;
for(int i = 0; i < adjList.size(); i++){
temp = adjList.get(i);
temp.setDist(-1);
temp.setPred(-1);
}
getVertexFromHandle(startingVertex).setDist(0);
}
private ArrayList<Integer> findPath(int start, int end, ArrayList<Integer> path){
return path;
}
public ArrayList<Integer> findMinimumPath(String s1, String s2){
int s1Handle = findStringHandle(s1);
int s2Handle = findStringHandle(s2);
buildDijkstraGraph(s1Handle);
return findPath(s1Handle, s2Handle, new ArrayList<Integer>());
}
} }
...@@ -7,11 +7,31 @@ public class Vertex { ...@@ -7,11 +7,31 @@ public class Vertex {
private String key; private String key;
private int handle; private int handle;
private ArrayList<Edge> edges; private ArrayList<Edge> edges;
private int pred;
private int dist;
public Vertex(String word, int handle, ArrayList<Edge> neighbors) { public Vertex(String word, int handle, ArrayList<Edge> neighbors) {
this.key = word; this.key = word;
this.handle = handle; this.handle = handle;
this.edges = neighbors; this.edges = neighbors;
pred = -1;
dist = -1;
}
public int getPred() {
return pred;
}
public void setPred(int pred) {
this.pred = pred;
}
public int getDist() {
return dist;
}
public void setDist(int dist) {
this.dist = dist;
} }
public int getHandle() { public int getHandle() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment