previous up next
Go backward to Construction
Go up to Top
Go forward to Observation
RISC-Linz logo

Sequential Algorithm

AllPairsShortestPaths(W):
  D = W
  for i=1 to n-1 do
    D = MatMin(D, W)
  return D

MatMin(D, W):
  for i=1 to n do
    for j=1 to n do
      E[i,j] = D[i,j]
      for k=1 to n do
        E[i,j] = min(E[i,j],D[i,k]+W[k,j])
  return E

Author: Wolfgang Schreiner
Last Modification: October 13, 1997

previous up next