Consider a relation R= {(1, 1) (1, 3), (2, 2), (2,3) (3,1)on the set A = (1,2,3) Find transitive using warshalls algorithm... closure of the relation R consider
1
Expert's answer
2021-12-22T09:36:21-0500
Consider a relation R={(1,1),(1,3),(2,2),(2,3),(3,1)} on the set A={1,2,3}.
Let us state the steps of the Warshall's algorithm:
1. LetW:=MR,k:=0.
2. Put k:=k+1.
3. For all i=k such that wik=1 and for all j let wij=wij∨wkj.
4. If k=n then stop and W=MR∗, else go to step 2.
Let us find transitive closure of the relation R using Warshall's algorithm:
W(0)=MR=⎝⎛101010110⎠⎞
W(1)=⎝⎛101010111⎠⎞
W(2)=⎝⎛101010111⎠⎞
MR∗=W(3)=⎝⎛111010111⎠⎞
It follows that R∗={(1,1),(1,3),(2,1),(2,2),(2,3),(3,1),(3,3)}.
Comments