Do less work in FloydWarshall