(* WARSHALL'S ALGORITHM FOR TRANSITIVE CLOSURE *) PROGRAM CWARSHAL (INPUT,OUTPUT) ; TYPE GYORETSU=ARRAY[ 1..10,1..10 ] OF INTEGER ; VAR A,R : GYORETSU ; N,I,J : INTEGER ; {EXTERNAL PROCEDURE WARSHAL (N:INTEGER ; A:GYORETSU ; VAR R:GYORETSU );} {$I B:WARSHAL.SRC} BEGIN (*CWARSHAL*) READ (N) ; FOR I:=1 TO N DO BEGIN READLN ; FOR J:=1 TO N DO READ (A[I,J]) END ; WARSHAL (N,A,R) ; WRITELN(LST) ; WRITELN (LST,'A':1) ; FOR I:=1 TO N DO BEGIN FOR J:=1 TO N DO WRITE (LST,A[I,J]:3) ; WRITELN(LST) END ; WRITELN (LST) ; WRITELN (LST,'R : TRANCITIVE CLOSURE OF A':27) ; FOR I:=1 TO N DO BEGIN FOR J:=1 TO N DO WRITE (LST,R[I,J]:3) ; WRITELN (LST) END END.