1 / 14

Representing Relations

Representing Relations. Rosen 7.3. Using Matrices. For finite sets we can use zero-one matrices. Elements of each set A and B must be listed in some particular (but arbitrary) order. When A=B we use the same ordering for A and B. m ij = 1 if (a i ,b j ) R = 0 if (a i ,b j ) R.

minowa
Download Presentation

Representing Relations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Representing Relations Rosen 7.3

  2. Using Matrices For finite sets we can use zero-one matrices. Elements of each set A and B must be listed in some particular (but arbitrary) order. When A=B we use the same ordering for A and B. mij = 1 if (ai,bj) R = 0 if (ai,bj) R

  3. Example Zero-One Matrix b1 b2 b3 a1 a2 a3 R = {(a1,b1), (a1,b2), (a2,b2), (a3,b2), (a3,b3)}

  4. Matrix of a relation on a set, A Can be used to determine whether the relations has certain properties. Recall that R on A is reflexive if (a,a) R for every element a A. Reflexive Not Reflexive

  5. A relation R on a set A • is called Symmetric if (b,a) R whenever (a,b) R for a,b A. MR = (MR)t • is Antisymmetric if (a,b) R and (b,a) R only if a=b for a,b A is antisymmetric. • If mij = 1, ij, mji = 0 Symmetric Antisymmetric Neither

  6. Examples Reflexive Symmetric Reflexive Antisymmetric

  7. Let R1, R2 be relations on A A = {1,2,3} R1 = {(1,1), (1,3), (2,1), (3,3)} R2 = {(1,1), (1,2), (1,3), (2,2), (2,3), (3,1)}

  8. R1R2, R1R2 MR1R2 = MR1  MR2, MR1R2 = MR1  MR2

  9. What is R2  R1? R1 = {(1,1), (1,3), (2,1), (3,3)} R2 = {(1,1), (1,2), (1,3), (2,2), (2,3), (3,1)} The composite of R1 and R2 is the relation consisting of ordered pairs (a,c) where a  A, c  A, and for which there exists an element b  A such that (a,b)  R1 and (b,c)  R2. R2  R1 = {(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1)}

  10. Boolean Product Let A = [aij] be an m by k zero-one matrix and B = [bij] be a k by n zero-one matrix. Then the Boolean Product of A and B denoted by A B is the m by n matrix with i,j entry cij where cij = (ai1b1j)  (ai2  b2j) ...  (aik  bkj).

  11. What is R2  R1? R2  R1 = {(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1)} MR2R1 =MR1 MR2

  12. Directed Graphs (Digraph) • A directed graph consists of a set V of vertices together with a set E of ordered pairs of elements of V called edges. • (a,b), a is initial vertex, b is the terminal vertex Reflexive (Loops at all vertices) Symmetric (All edges both ways) b a c

  13. Relation R on a set A R = {(a,b), (b,b), (b,c), (c,a), (c,c)} Transitive? No b a c R = {(a,b), (b,b), (b,c), (a,c), (c,c)} Transitive? Yes b a Rosen, pp. 493-494 c

  14. Relation R on a set A R = {(a,a), (a,c), (b,b), (b,a), (b,c), (c,c)} Reflexive Antisymmetric Transitive b a c

More Related