Runs the shortest path calculation from the adjacency map, returning a map that contains the "prev" entries for each word in the graph.