Implementing the Floyd-Warshall Algortihm