fixing floyd warshall for our purpose