let dist be a |V| × |V| array of minimum distances initialized to ∞ (infinity)
// part 1
for each vertex v
dist[v][v] ← 0
// part 2
for each edge (u,v)
dist[u][v] ← w(u,v) // the weight of the edge (u,v)
// part 3
for k from 1 to |V|
for i from 1 to |V|
for j from 1 to |V|
if dist[i][k] + dist[k][j] < dist[i][j] then
dist[i][j] ← dist[i][k] + dist[k][j]
在页面中,它说the Floyd–Warshall algorithm assumes that there are no negative cycles
。所以我的问题是如果入口图隐藏了负圆会发生什么。输出会dist
代表另一个隐藏负圆的图吗?这不part 1
无效吗?