find shortest paths between every pair of vertices in the graph