Content deleted Content added
Predecessor matrix? |
|||
Line 15:
I will change this soon if nobody protests
== Predecessor matrix? ==
Wouldn't it be advantageous to also mention the predecessor matrix Pk[i,j] defined as the predecessor of j on the shortest path from i to j, using internal nodes 1...k?
We would add the following to the pseudocode. First initialization:
'''var''' '''int'''[0..n,0..n] pred
'''for''' i '''from''' 0 '''to''' n
'''for''' j '''from''' 0 '''to''' n
'''if''' dist[i,j] > 0
pred[i,j] := i
Next, we add one more line after the "dist[i,j] = dist[i,k] + dist[k,j]" line:
pred[i,j] = pred[k,j]
I'm not entirely sure if this addition would be appreciated. Being a novice Wikipedian, I decided I won't make the addition but rather post it here. If an experienced Wikipedian thinks it's a good addition, please make it.
|