Question #284169

For the relation R = {(p,p) ,(q,p),(q,q),(r,r),(r,s),(s,s) ,(s,m) ,(m,m)}



1.Using warshall algorithm find the transitive closure R* of R



2.write matrix representation of R*



3.Check whether the relation of R* is an equivalence relation or a partial order.



1
Expert's answer
2022-01-05T11:27:31-0500

Consider a relation R={(p,p),(q,p),(q,q),(r,r),(r,s),(s,s),(s,m),(m,m)}R = \{(p,p) ,(q,p),(q,q),(r,r),(r,s),(s,s) ,(s,m) ,(m,m)\} on the set A={p,q,r,s,m}A=\{p,q,r,s,m\}.


1. Let us state the steps of the Warshall's algorithm:


1. Let W:=MR, k:=0.W:=M_R,\ k:=0.

2. Put k:=k+1.k:=k+1.

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

4. If k=nk=n then stop and W=MR,W=M_{R^*}, else go to step 2.


Let us find transitive closure of the relation RR using Warshall's algorithm:


W(0)=MR=(1000011000001100001100001)W^{(0)}=M_R =\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 1 & 0\\ 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}


W(1)=(1000011000001100001100001)W^{(1)} =\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 1 & 0\\ 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}


W(2)=(1000011000001100001100001)W^{(2)} =\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 1 & 0\\ 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}


W(3)=(1000011000001100001100001)W^{(3)} =\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 1 & 0\\ 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}


W(4)=(1000011000001110001100001)W^{(4)} =\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 1 & 1\\ 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}


MR=W(5)=(1000011000001110001100001)M_{R^*}=W^{(5)} =\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 1 & 1\\ 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}


It follows that R={(p,p),(q,p),(q,q),(r,r),(r,s),(r,m),(s,s),(s,m),(m,m)}.R^*= \{(p,p) ,(q,p),(q,q),(r,r),(r,s), (r,m),(s,s) ,(s,m) ,(m,m)\}.


2. Let us write the matrix representation of R.R^*. It follows from the previous item that


MR=(1000011000001110001100001)M_{R^*} =\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 1 & 1\\ 0 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}


3. Let us check whether the relation of RR^* is an equivalence relation.

Since (q,p)R(q,p)\in R^* but (p,q)R,(p,q)\notin R^*, we conclude that the relation is not symmetric, and hence it is not an equivalence relation.


Let us check whether the relation of RR^* is a partial order.

Since {(p,p),(q,q),(r,r),(s,s),(m,m)}R,\{(p,p),(q,q),(r,r),(s,s) ,(m,m)\}\subset R^*, the relation RR^* is reflexive. Taking into account that (a,b)R(a,b)\in R^* and (b,a)R(b,a)\in R^* imply a=ba=b for any (a,b),(a,b)R(a,b),(a,b)\in R^*, we conclude that this relation is antisymmetric. Since RR^* is the transitive closure, it is transitive.

We conclude that RR^* is a partial order.


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