Question #140815
Let R be the relation on the set A = {a, b, c, d, e, f} and
R = {(a,c), (b,d), (c,a), (c,e), (d,b), (d,f), (e,c), (f,d)}
Find the transitive closure pf R using Warshall’s algorithm.
1
Expert's answer
2020-10-29T20:32:00-0400

R={(a,c),(b,d),(c,a),(c,e),(d,b),(d,f),(e,c),(f,d)}R = \{(a,c), (b,d), (c,a), (c,e), (d,b), (d,f), (e,c), (f,d)\}


Here are the steps of the Warshall’s algorithm:


Step 1. Assign initial values W=MR,k=0W=M_R, k=0.


Step 2. Execute k:=k+1.k:=k+1.


Step 3. For all iki\ne k such that wik=1w_{ik}=1, and for jj execute the operation wij=wijwkj.w_{ij}=w_{ij}\lor w_{kj}.


Step 4. If k=nk=n, then stop: we have the solution W=MRW=M_{R^*}, else go to the step 2.



n=A=6.n=|A|=6.


W(0)=MR=(001000000100100010010001001000000100)W^{(0)}=M_R=\left(\begin{array} {cccccc} 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 & 0\\ 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0\end{array}\right)



W(1)=(001000000100101010010001001000000100)W^{(1)}=\left(\begin{array} {cccccc} 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 & 0\\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0\end{array}\right)



W(2)=(001000000100101010010101001000000100)W^{(2)}=\left(\begin{array} {cccccc} 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 & 0\\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0\end{array}\right)



W(3)=(101010000100101010010101101010000100)W^{(3)}=\left(\begin{array} {cccccc} 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 & 0 & 0\\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0\end{array}\right)


W(4)=(101010010101101010010101101010010101)W^{(4)}=\left(\begin{array} {cccccc} 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1\end{array}\right)



W(5)=(101010010101101010010101101010010101)W^{(5)}=\left(\begin{array} {cccccc} 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1\end{array}\right)



MR=W(6)=(101010010101101010010101101010010101)M_{R^*}=W^{(6)}=\left(\begin{array} {cccccc} 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1\end{array}\right)


Therefore, the transitive closure of RR is the following:


R={(a,a),(a,c),(a,e),(b,b),(b,d),(b,f),(c,a),(c,c),(c,e),(d,b),(d,d),R^* = \{(a,a),(a,c),(a,e), (b,b),(b,d),(b,f), (c,a),(c,c), (c,e), (d,b),(d,d),

(d,f),(e,a),(e,c),(e,e),(f,b),(f,d),(f,f)}(d,f),(e,a), (e,c),(e,e),(f,b), (f,d),(f,f) \}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS