Before
sage: g = graphs.Grid2dGraph(60,60)
sage: %time d = g.shortest_path_all_pairs()
CPU times: user 14.52 s, sys: 0.51 s, total: 15.03 s
Wall time: 15.03 s
sage: g = graphs.Grid2dGraph(30,30)
sage: %timeit d = g.shortest_path_all_pairs()
5 loops, best of 3: 752 ms per loop
sage: g = graphs.PetersenGraph()
sage: %timeit d = g.shortest_path_all_pairs()
625 loops, best of 3: 73.5 µs per loop
After
sage: g = graphs.Grid2dGraph(60,60)
sage: %time d = g.shortest_path_all_pairs()
CPU times: user 10.70 s, sys: 0.53 s, total: 11.23 s
Wall time: 11.24 s
sage: g = graphs.Grid2dGraph(30,30)
sage: %timeit d = g.shortest_path_all_pairs()
5 loops, best of 3: 549 ms per loop
sage: g = graphs.PetersenGraph()
sage: %timeit d = g.shortest_path_all_pairs()
625 loops, best of 3: 53.4 µs per loop