The key point in implementing Dijkstra's algorithm, from a
computational point of view, is the selection of
in D1. This is
an element
with a minimum value of
. 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
ordered, in an opposite sense, by
.