Update Floyd-Warshall algorithm to use much less space