Shortest Path Algorithm

Given a weighted graph and a node X, find the shortest path from X to each node in the graph.

Each entry on READY is a triple:

<Node Name, Path, Path Length>

READY is a priority queue. Path Length is the priority. The entry with the smallest Path Length is the next one removed.

We want the shortest path to N, not the first one. N can't be marked REACHED until we are sure we have the shortest path, i.e. when entry for N is removed from READY.

Instead of REACHED, we use PROCESSED and UNPROCESSED.

When adding a triple to READY, if there is already one for the same node, we keep the one with the shortest Path Length.