Consider a relation R={(1,2),(2,1),(2,3),(3,4),(4,1)} on the set A={1,2,3,4}.
Let us state the steps of the Warshall's algorithm:
Step 1. Let W:=MR, k:=0.
Step 2. Put k:=k+1.
Step 3. For all i=k such that wik=1 and for all j let wij=wij∨wkj.
Step 4. If k=n then STOP: W=MR∗, else go to Step 2.
Let us find transitive closure of the relation R using Warshall's algorithm:
W(0)=MR=⎝⎛0101100001000010⎠⎞
W(1)=⎝⎛0101110101000010⎠⎞
W(2)=⎝⎛1101110111010010⎠⎞
W(3)=⎝⎛1101110111011111⎠⎞
MR∗=W(4)=⎝⎛1111111111111111⎠⎞
It follows that R∗=A×A is a universal relation on the set A.
Comments