Download presentation

Presentation is loading. Please wait.

Published byMicheal Fish Modified about 1 year ago

1
8.3 Representing Relations Connection Matrices Let R be a relation from A = {a 1, a 2,..., a m } to B = {b 1, b 2,..., b n }. Definition: A n m n connection matrix M for R is defined by M ij = 1 if is in R, = 0 otherwise. Example: We assume the rows are labeled with the elements of A and the columns are labeled with the elements of B. Let A = {a, b, c}, B = {e, f, g, h}; R = {, } Then the connection matrix M for R is Note: the order of the elements of A and B matters 1

2
Representing Relations Theorem: Let R be a binary relation on a set A and let M be its connection matrix. Then R is reflexive iff M ii = 1 for all i. R is symmetric iff M is a symmetric matrix: M = M T R is antisymetric if M ij = 0 or M ji = 0 for all i ≠ j. FIGURE 1 The Zero-One Matrix for a Reflexive Relation. FIGURE 2 The Zero-One Matrices for Symmetric and Antisymmetric Relations. 2

3
Combining Connection Matrices Example 3: Suppose that the relation R on a set is represented by the matrix Is R reflexive, symmetric and/or antisymmetric? Definition: the join of two matrices M 1, M 2, denoted M 1 M 2, is the component wise boolean ‘or’ of the two matrices. Fact: If M 1 is the connection matrix for R 1 and M 2 is the connection matrix for R 2 then the join of M 1 and M 2, M 1 M 2 is the connection matrix for R 1 ∪ R 2. 3

4
Combining Connection Matrices Definition: the meet of two matrices M 1, M 2, denoted M 1 M 2 is the componentwise boolean ‘and’ of the two matrices. Fact: If M 1 is the connection matrix for R 1 and M 2 is the connection matrix for R 2 then the meet of M 1 and M 2, M 1 M 2 is the connection matrix for R 1 ∩R 2. Example 4: Suppose that the relations R 1 and R 2 on a set A are represented by the matrices. and, What are the matrices representing R 1 ∪ R 2 and R 1 ∩R 2 ? 4

5
The Composition Definition: Let M 1 be the connection matrix for R 1 M 2 be the connection matrix for R 2. The boolean product of two connection matrices M 1 and M 2, denoted M 1 M 2, is the connection matrix for the composition of R 2 with R 1, R 2 。 R 1. (M 1 M 2 ) ij = k=1 n [(M 1 ) ik (M 2 ) kj ] Why? 5

6
The Composition In order for there to be an arc in the composition then there must be and arc in R 1 and an arc in R 2 for some y ! The Boolean product checkes all possible y’s. If at least one such path exists, that is sufficient. Note: the matrices M 1 and M 2 must be conformable: the number of columns of M 1 must equal the number of rows of M 2. If M 1 is m n and M 2 is n p then M 1 M 2 is m p. 6

7
The Composition Example : 7 (M 1 M 2 ) 12 [(M 1 ) 11 (M 2 ) 12 ] [(M 1 ) 12 (M 2 ) 22 ] [(M 1 ) 13 (M 2 ) 32 ] [(M 1 ) 14 (M 2 ) 42 ] = [0 0] [1 1] [0 0] [0 1] 1

8
The Composition Note: there is an arc in R 1 from node 1 in A to node 2 in B there is an arc in R 2 from node 2 in B to node 2 in C. Hence there is an arc in R 2 。 R 1 from node 1 in A to node 2 in C. 8

9
Representing Relations Using Digraphs Definition 1: A directed graph, or digraph, consists of a set V of vertices (or nodes ) together with a set E of ordered pairs of elements of V called edges (or arcs). The vertex a is called the initial vertex of the edge (a, b), and the vertex b is called the terminal vertex of this edge. An edge of the form (a, a) is represented using an arc from the vertex a back to itself. Such an edge is called a loop. 9

10
Representing Relations Using Digraphs Example 7: The directed graph with vertices a, b, c, and d, and edges (a, b), (a, d), (b, b), (b, d), (c, a), (c, b), and (d, b) is displayed in Figure 3. FIGURE 3 The Directed Graph. 10

11
Representing Relations Using Digraphs Example 8: The directed graph of the relation R={(1, 1), (1, 3), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (4, 1)} on the set {1, 2, 3, 4} is shown in figure 4. FIGURE 4 The Directed Graph of the Relations R. 11

12
Representing Relations Using Digraphs Example 9: What are the ordered pairs in the relation R represented by the directed graph shown in figure 5? FIGURE 5 The Directed Graph of the Relations R. 12

13
Representing Relations Using Digraphs Example 10: Determine whether the relations for the directed graphs shown in figure 6 are reflexive, symmetric, antisymmetric, and/or transitive. FIGURE 6 The Directed Graph of the Relations R and S. 13

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google