Preliminary completion of shortest path algorithm.