Question #234233

Find the transitive closure A={1,2,3,4,5}

R={ (2,3),(3,5),((1,2),(2,5),(1,3),(4,5),(5,2)} by using Warshall’s Algorithm.


1
Expert's answer
2021-09-07T19:06:18-0400

M(R)=(0110000101000010000101000)\begin{pmatrix} 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 0 \\ \end{pmatrix} matrix of relation R

Step 1: k=1

previous: (0ˉ1ˉ1ˉ0ˉ0ˉ0ˉ01010ˉ00010ˉ00010ˉ1000)\begin{pmatrix} \bar 0 & \bar 1 & \bar 1 & \bar0 & \bar0 \\ \bar 0 & 0 & 1 & 0 & 1 \\ \bar0 & 0 & 0 & 0 & 1 \\ \bar0 & 0 & 0 & 0 & 1 \\ \bar0 & 1 & 0 & 0 & 0 \\ \end{pmatrix} next : (0110000101000010000101000)\begin{pmatrix} 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 0 \\ \end{pmatrix}

Matrix unchanged

Step 2: k=2

previous:(01ˉ10>00ˉ0ˉ1ˉ0ˉ1ˉ00ˉ00100ˉ00101ˉ>00>0)\begin{pmatrix} 0 & \bar1 & 1 & 0 &> 0 \\ \bar0 &\bar 0 & \bar1 & \bar0 & \bar1 \\ 0 & \bar0 & 0 & 0 & 1 \\ 0 & \bar0 & 0 & 0 & 1 \\ 0 & \bar1 & >0 & 0& >0 \\ \end{pmatrix} next: (0110100101000010000101101)\begin{pmatrix} 0 & 1 & 1 & 0 & 1 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0& 1 \\ \end{pmatrix}

Thee edges have added.

Step 3: k=3

previous:(011ˉ01001ˉ010ˉ0ˉ0ˉ0ˉ1ˉ000ˉ01011ˉ01)\begin{pmatrix} 0 & 1 & \bar 1 & 0 & 1 \\ 0 & 0 & \bar 1 & 0 & 1 \\ \bar0 & \bar 0 & \bar0 & \bar0 & \bar 1\\ 0 & 0 & \bar0 & 0 & 1 \\ 0 & 1 & \bar1 & 0& 1 \\ \end{pmatrix} next: (0110100101000010000101101)\begin{pmatrix} 0 & 1 & 1 & 0 & 1 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1\\ 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0& 1 \\ \end{pmatrix}

Matrix is unchanged

Step 4: k=4 Matrix will not change because fourth column is zeros.

Step 5: k=5

previous:(01101ˉ0>0101ˉ0>0>001ˉ0>0>001ˉ0ˉ1ˉ1ˉ0ˉ1ˉ)previous:\begin{pmatrix} 0 & 1 & 1 & 0 & \bar1 \\ 0 & >0 & 1 & 0 & \bar1 \\ 0 & > 0 & >0 & 0 & \bar1\\ 0 & >0 &> 0 & 0 & \bar1 \\ \bar0 & \bar1 & \bar1 &\bar 0& \bar1 \\ \end{pmatrix}

final: (0110101101011010110101101)\begin{pmatrix} 0 & 1 & 1 & 0 & 1 \\ 0 & 1& 1 & 0 & 1 \\ 0 & 1 & 1& 0 & 1\\ 0 & 1 &1 & 0 & 1 \\ 0 & 1 & 1 & 0& 1 \\ \end{pmatrix} - matrix of transitive closure

Thus Rˉ\bar R ={(1,2),(1,3),(1,5),(2,2),(2,3),(2,5),(3,2),(3,3),(3,5),(4,2),(4,3),(4,5),(5,2),(5,3),(5,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