Let A={1,2,3,4,5} and R be the relation on A such that R={(1,4),(2,1),(2,5),(2,4),(4,3),(5,3),(3,2)}.
Warshall's Algorithm:
Step 1: put W:=MR, k:=0.
Step 2: put k:=k+1.
Step 3: for all i=k such that wik=1, and for all j put wij:=wij∨wkj.
Step 4: if k=n then STOP else go to the step 2.
Let us find the transitive closure of R by Warshall's Algorithm:
W(0)=MR=⎝⎛0100000100000111100001000⎠⎞
W(1)=⎝⎛0100000100000111100001000⎠⎞
W(2)=⎝⎛0110000100000111110001100⎠⎞
W(3)=⎝⎛0111100111000111111101111⎠⎞
W(4)=⎝⎛1111111111111111111111111⎠⎞
MR∗=W(5)=⎝⎛1111111111111111111111111⎠⎞
It follows that the transitive closure R∗ of R is the following:
R∗=A×A.