COS 226 Exercises on Shortest Paths

1. Label the following points in the plane 0 through 8, respectively:
 (1, 3) (2, 1) (2, 6) (1, 6) (6, 6) (3, 4) (3, 6) (5, 2) (5, 7)
Taking edge lengths to be weights (round up to the next integer to make your calculations easier), consider the weighted directed graph defined by the edges
0-1 0-2 2-6 5-6 1-5 1-4 1-7 1-3 3-7 4-8 6-8 4-5 4-7
Run Dijkstra's single source shortest path algorithm on the above graph using point 0 as the source. Give the order in which the shortest path tree edges are selected.

















2. Give the all-shortest-paths distance matrix that is produced by Floyd's algorithm when run on the graph above.