Implementation of Floyd Warshall