Since Floyd's algorithm sequentially relaxes the distances between all pairs of vertices (i, j), including those with i=j, and the initial distance between a pair of vertices (i, i) is equal to zero, then relaxation can occur only if vertex k such that d[i][k]+d[k][i]<0, which is equivalent to having a negative cycle through vertex i