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.

Slides:



Advertisements
Similar presentations
Representing Relations
Advertisements

Chapter Matrices Matrix Arithmetic
Relations Relations on a Set. Properties of 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.
CSE115/ENGR160 Discrete Mathematics 04/26/12 Ming-Hsuan Yang UC Merced 1.
1 Section 7.3 Representing relations (part 1: matrices)
Lecture 17 Path Algebra Matrix multiplication of adjacency matrices of directed graphs give important information about the graphs. Manipulating these.
Representing Relations Using Matrices
5/16/20151 You Never Escape Your… Relations. 5/16/20152Relations If we want to describe a relationship between elements of two sets A and B, we can use.
Applied Discrete Mathematics Week 11: Graphs
1 Representing Relations Part 2: directed graphs.
Graphs, relations and matrices
MATRICES. Matrices A matrix is a rectangular array of objects (usually numbers) arranged in m horizontal rows and n vertical columns. A matrix with m.
1 Representing Relations Epp section ??? CS 202 Aaron Bloomfield.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Applied Discrete Mathematics Week 10: Equivalence Relations
Chapter Relations and Their Properties 8.2 n-ary Relations and Their Applications 8.3 Representing Relations 8.4 Closures of Relations 8.5 Equivalence.
Chapter 2 Graph Algorithms.
Properties of Relations In many applications to computer science and applied mathematics, we deal with relations on a set A rather than relations from.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Based on slides by Y. Peng University of Maryland
CSC-2259 Discrete Structures
Discrete Structures1 You Never Escape Your… Relations.
1 Closures of Relations: Transitive Closure and Partitions Sections 8.4 and 8.5.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Discrete Mathematics Relation.
Fall 2002CMSC Discrete Structures1 You Never Escape Your… Relations.
CSCI 171 Presentation 9 Matrix Theory. Matrix – Rectangular array –i th row, j th column, i,j element –Square matrix, diagonal –Diagonal matrix –Equality.
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
1 Chapter Equivalence, Order, and Inductive Proof.
Lecture on Relations 1Developed by CSE Dept., CIST Bhopal.
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Discrete Structures – CNS2300
Problem Statement How do we represent relationship between two related elements ?
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
Chapter Relations and Their Properties
1 Section 4.1 Properties of Binary Relations A binary relation R over a set A is a subset of A  A. If (x, y)  R we also write x R y. Example. Some sample.
Equivalence Relations
Graphs Basic properties.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
8.4 Closures of Relations Definition: The closure of a relation R with respect to property P is the relation obtained by adding the minimum number of.
Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and B = {a,b} {( 0, a), (
Section 7.3: Representing Relations In this section, we will cover two ways to represent a relation over a finite set other than simply listing the relation.
1 Closures of Relations Based on Aaron Bloomfield Modified by Longin Jan Latecki Rosen, Section 8.4.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
CS 285- Discrete Mathematics Lecture 11. Section 3.8 Matrices Introduction Matrix Arithmetic Transposes and Power of Matrices Zero – One Matrices Boolean.
A very brief introduction to Matrix (Section 2.7) Definitions Some properties Basic matrix operations Zero-One (Boolean) matrices.
Module Code MA1032N: Logic Lecture for Week Autumn.
Chapter8 Relations 8.1: Relations and their properties.
Representing Relations Using Digraphs
Discrete Mathematical
Relations and Their Properties
Relations.
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Relations Chapter 9.
Representing Relations
CSE115/ENGR160 Discrete Mathematics 04/28/11
Matrix Representation of Graph
Mathematical Structures for Computer Science Chapter 6
Applied Discrete Mathematics Week 10: Equivalence Relations
Representing Relations
Discrete Math (2) Haiming Chen Associate Professor, PhD
Combining relations via relational composition
Chapter 8 (Part 2): Relations
Agenda Lecture Content: Relations (Relasi)
Representing Relations Using Matrices
Presentation transcript:

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

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

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

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

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

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

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

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

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

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

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

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

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