Here's the algorithm that I'm supposed to use.

void dijksra(Vertex start) { for each Vertex v in V { v.dist = Integer.MAX_VALUE; v.known = false; v.path = null; } start.distance = 0; while there are unknown vertices { v = unknown vertex with smallest distance v.known = true; for each Vertex w adjacent to v if (!w.known) if (v.dist + weight(v, w)< w.distance){ decrease(w.dist to v.dist+weight(v, w)) w.path = v; } } }

And here's what I have so far.

void Dijkstra(Vertex src) // create dijkstra class { Vertex v,w; src.dist = 0; // create PriorityQueue PriorityQueue<Vertex> queue = new PriorityQueue<Vertex>(); queue.add(src); for (;;)/>/> { v = PriorityQueue.deleteMin(); //smallest unknown vertex if ( v == null) break; v.known = true; // cost of the shortest path to vertex is found for (w.adj: v.adj) // adjacency list { if (!w.known) // another shorter path might still be found if (v.dist + cost(v,w) < w.dist) { w.dist = (v.dist + cost(v,w)); w.path = v; // shortest path } } } }

So the question is am I on the right track for implementing this algorithm and if not, any ideas of what I could change? Thanks.