next up previous index
Next: Workspace Up: Shortest Paths in Weighted Previous: Shortest paths   Index


Java implementation

The key point in implementing Dijkstra's algorithm, from a computational point of view, is the selection of $v$ in D1. This is an element $v \in S^{\ast}-S$ with a minimum value of $D(v)$. In other words, we have to pick a minimum element out of an ordered set. But this is exactly what is done by a PriorityQueue so long as higher priorities are associated with shorter distances. We shall make use of this idea shortly, implementing the priority queue by a BinaryHeap. The heap is a representation of $S^{\ast}-S$ ordered, in an opposite sense, by $D$.



Subsections

Peter Williams 2005-06-07