我正在尝试实现此算法的递归功能,该功能取自the wiki page:
1 let dist be a |V| × |V| array of minimum distances initialized to ∞ (infinity)
2 for each edge (u,v)
3 dist[u][v] ← w(u,v) // the weight of the edge (u,v)
4 for each vertex v
5 dist[v][v] ← 0
6 for k from 1 to |V|
7 for i from 1 to |V|
8 for j from 1 to |V|
9 if dist[i][j] > dist[i][k] + dist[k][j]
10 dist[i][j] ← dist[i][k] + dist[k][j]
11 end if
我尝试了一些实现,但是只有一个返回正确的值,但是我被告知错误实现了。如何为该算法实现递归函数?