Question #117158
Use Warshall’s algorithm to find the transitive closure of the relation R = {(1,1),(1,4), (2,5),(2,3),(3,1),(3,5),(3,4),(4,2)} on the set A = {1,2,3,4,5}.
1
Expert's answer
2020-06-16T17:37:25-0400

A={1,2,3,4,5}R={(1,1),(1,4),(2,5),(2,3),(3,1),(3,5),(3,4),(4,2)}A=\\\{1,2,3,4,5\}\\ R=\{(1,1),(1,4), (2,5),(2,3),(3,1),(3,5),\\ (3,4),(4,2)\}

wij(k)={wik(k1)wkj(k1),ifwkj(k1)=1wij(k1),ifwik(k1)=0}w_{ij}^{(k)}=\left\{\begin{matrix} w_{ik}^{(k-1)}\lor w_{kj}^{(k-1)}, \quad if \quad w_{kj}^{(k-1)}=1\\ w_{ij}^{(k-1)}, \quad if \quad w_{ik}^{(k-1)}=0 \end{matrix}\right\}



W0=12345110010200101310011401000500000W_0=\begin{matrix} &1_{-}&2_{-}&3_{-}&4_{-}&5_{-} \\ 1_{-} & 1&0&0&1&0\\ 2_{-}&0&0&1&0&1\\ 3_{-}&1&0&0&1&1\\ 4_{-}&0&1&0&0&0\\ 5_{-}&0&0&0&0&0 \end{matrix}

Find W1W_1

W1=12345110010200101310011401000500000W_1=\begin{matrix} &1_{-}&2_{-}&3_{-}&4_{-}&5_{-} \\ 1_{-} & 1&0&0&1&0\\ 2_{-}&0&0&1&0&1\\ 3_{-}&1&0&0&1&1\\ 4_{-}&0&1&0&0&0\\ 5_{-}&0&0&0&0&0 \end{matrix}


W2=12345110010200101310011401101500000W_2=\begin{matrix} &1_{-}&2_{-}&3_{-}&4_{-}&5_{-} \\ 1_{-} & 1&0&0&1&0\\ 2_{-}&0&0&1&0&1\\ 3_{-}&1&0&0&1&1\\ 4_{-}&0&1&1&0&1\\ 5_{-}&0&0&0&0&0 \end{matrix}


W3=12345110010210111310011411111500000W_3=\begin{matrix} &1_{-}&2_{-}&3_{-}&4_{-}&5_{-} \\ 1_{-} & 1&0&0&1&0\\ 2_{-}&1&0&1&1&1\\ 3_{-}&1&0&0&1&1\\ 4_{-}&1&1&1&1&1\\ 5_{-}&0&0&0&0&0 \end{matrix}


W4=12345111111211111311111411111500000W_4=\begin{matrix} &1_{-}&2_{-}&3_{-}&4_{-}&5_{-} \\ 1_{-} & 1&1&1&1&1\\ 2_{-}&1&1&1&1&1\\ 3_{-}&1&1&1&1&1\\ 4_{-}&1&1&1&1&1\\ 5_{-}&0&0&0&0&0 \end{matrix}


W4=W5W_4=W_5



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