Floyd-Warshall algorithm implemented.