PROCEDURE DISTANC (N:INTEGER ; W:GYORETSU ; VAR D:GYORETSU) ; VAR I,J,K : INTEGER ; BEGIN (*DISTANCE*) FOR I:=1 TO N DO FOR J:=1 TO N DO D[I,J]:=W[I,J] ; FOR K:=1 TO N DO FOR I:=1 TO N DO FOR J:=1 TO N DO IF D[I,J]<(D[I,K]+D[K,J]) THEN D[I,J]:=D[I,J] ELSE D[I,J]:=D[I,K]+D[K,J] END ;