Floyd-Warshall algorithm for computing all-pairs shortest paths