Presentation is loading. Please wait.

Presentation is loading. Please wait.

4.2 Relations and Digraphs

Similar presentations


Presentation on theme: "4.2 Relations and Digraphs"— Presentation transcript:

1 4.2 Relations and Digraphs

2 We show a relation between two sets A and B by writing aRb.
This shows which elements of A are related to elements of B A = {1,2,3} B = {r,s} R = {(1,r),(2,s),(3,r)} Relation from A to B

3 The Domain of R can be written Dom(R)
The Domain of R is the set of elements from A that are related to B. The Range of R can be written Ran(R). The Range of R is the set of elements from B that are the second elements of pairs in R.

4 Matrix of a relation Matrix of R MR = [mij]
Where i = row and j = column mij = 1 if (ai, bj) is an element of R = 0 if (ai, bj) is not an element of R

5 A = {1,2,3} B = {r,s} R = {(1,r), (2,s), (3,r)} a b r s 1 2 3

6 A = {a1, a2, a3} B = {b1 , b2, b3, b4 } (ai, bj) is an element of the relation if and only if mij = 1. i = row J = column R = {(a1,b1 ),(a1,b4),(a2,b2),(a2,b3),(a3,b1),(a3,b3)} b1 b2 b3 b4 a1 1 a2 a3

7 Insert zero’s where there are no 1’s
b1 b2 b3 b4 a1 1 a2 a3

8 Digraph A = {1,2,3,4} B = A R = {(1,1), (1,2), (2,1), (2,2), (2,3),(2,4), (3,4), (4,1)} All elements of A go in the circles. Arrows point to the second element of the pair. 2 1 3 4

9 Create a table of in degrees and out degrees based on the digraph.
Note: the sum of all in degrees must equal the sum of all out degrees. In degrees Out degrees 1 2 3 4 SUM 8

10 Given this digraph, find MR and R Look at the number in the circle then, look where the arrow goes out to. row,col row,col row,col row,col row,col row,col R = {(1,4), (1,5), (4,1), (4,4), (5,4), (5,5)} 1 4 5

11 a\b 1 MR = 4 5

12 Restriction of R to B is R ∩ (BXB)
R = {(a,a),(a,c),(b,c)} A = {a,b,c,d,e,f} B = {a,b,c} {a,b,c} BXB = {(a,a),(a,b),(a,c),(b,a),(b,b),(b,c),(c,a),(c,b),(c,c)} Look for where R and BXB have the same element pairs. The restriction of R to B is {(a,a),(a,c),(b,c)}


Download ppt "4.2 Relations and Digraphs"

Similar presentations


Ads by Google