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.

Slides:



Advertisements
Similar presentations
Representing Relations
Advertisements

Partial Orderings Section 8.6.
Identity and Inverse Matrices
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.
8.3 Representing Relations. Consider the following relations on A={1,2,3,4} Consider the matrixM R1 = | | | | | | | |
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.
1 Section 7.3 Representing relations (part 1: matrices)
Section 7.4: Closures of Relations Let R be a relation on a set A. We have talked about 6 properties that a relation on a set may or may not possess: reflexive,
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.
Discrete Mathematics Lecture # 16 Inverse of Relations.
1 Representing Relations Part 2: directed graphs.
Relations binary relations xRy on sets x  X y  Y R  X  Y Example: “less than” relation from A={0,1,2} to B={1,2,3} use traditional notation 0 < 1,
Graphs, relations and matrices
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
Relations (1) Rosen 6 th ed., ch. 8. Binary Relations Let A, B be any two sets. A binary relation R from A to B, written (with signature) R:A↔B, is a.
Properties of Relations In many applications to computer science and applied mathematics, we deal with relations on a set A rather than relations from.
Module #21 - Relations Representing Relations Rosen 6 th ed., Ch. 8.
Module #18: Relations, part I
Chapter 4 Relations and Digraphs
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Lecture 14 Relations CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
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.
8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.
Discrete Structures1 You Never Escape Your… Relations.
Discrete Mathematics Relation.
Relations and their Properties
Fall 2002CMSC Discrete Structures1 You Never Escape Your… Relations.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Section 4.4 Properties of Relations. Order Relations Draw an arrow diagram for the relation R defined on the set {1,2,3,4} such that
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.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
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,
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Relations Section 9.1, 9.3—9.5 of Rosen Spring 2012
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
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.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008.
A very brief introduction to Matrix (Section 2.7) Definitions Some properties Basic matrix operations Zero-One (Boolean) matrices.
Lecture 7: Relations Dr Andrew Purkiss-Trew Cancer Research UK Mathematics for Computing.
Module Code MA1032N: Logic Lecture for Week Autumn.
Chapter8 Relations 8.1: Relations and their properties.
Discrete Mathematical
Relations.
Learn about relations and their basic properties
Relations Chapter 9.
Relations and Digraphs
Representing Relations
CSE115/ENGR160 Discrete Mathematics 04/28/11
Mathematical Structures for Computer Science Chapter 6
Applied Discrete Mathematics Week 10: Equivalence Relations
Discrete Math (2) Haiming Chen Associate Professor, PhD
Combining relations via relational composition
Agenda Lecture Content: Relations (Relasi)
4.4 Properties of Relations
Presentation transcript:

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 elements or using set builder notation to specify the elements in the relation

Representing Relations Using Matrices Let A = {a 1, a 2, …, a n } be a finite set. Then we can represent a relation R over the set A using an n by n matrix: _ _ | e 11 e 12 … e 1n | | e 21 e 22 …e 2n | | … ……… | | e n1 e n2 …e nn | where entry e ij = 1 if (a i, a j )  R and e ij = 0 if (a i, a j )  R. Ex: Let A = {1, 2, 3} and R = {(1,1), (1, 2), (2, 3), (3, 1)}. Then _ _ | 110 | | 001 | | 100 | is the 3 by 3 zero-one matrix that represents the relation R.

This representation can be generalized in the obvious way to represent a relation R from A to B where both A and B are finite sets with m and n elements respectively. Then an m by n zero-one matrix can be used to represent the relation R. Ex: Let A = {1, 2, 3}, B = {a, b} and R = {(1,b), (2, a), (2, b)}. Then _ _ | 01 | | 11 | | 00 | is the 3 by 2 zero-one matrix that represents the relation R. We can use the matrix representation to store relations in a computer and efficiently perform certain operations on relations using matrix operations. We can also use the matrix representation of a relation to investigate whether the relation satisfies the various properties introduced in section 7.1.

We will concentrate on square matrices since most of the properties we introduced only apply to relations over a set A. _ _ | e 11 e 12 e 13 …e 1n | | e 21 e 22 e 23 …e 2n | | e 31 e 32 e 33 …e 3n | | …………… | | e n1 e n2 e n3 …e nn | Reflexive? Irreflexive? Symmetric? We can also use the matrix representation of a relation to compute the composite of two relations R and S. To compute S  R we simply multiply the matrix representing R with the matrix representing S. Note that this is a boolean matrix multiplication, meaning that the resulting entry can only be 0 or 1. So entries that exceed 1 when multiplied are returned to the value 1 for the resulting matrix.

Representing Relations Using Digraphs While the matrix representation is convenient for working with relations in a computer, a digraph representation is a more visually appealing way to represent a relation on a finite set. Let A = {a 1, a 2, …, a 3 } and let R be a relation on A. For the digraph representation of R, we use a labeled dot to represent each element of A. Then for each pair (a j, a k ) that is in R, we draw an arrow coming out of dot a j and that points to dot a k. Ex: Let A = {1, 2, 3, 4} and R = {(1, 2), (2, 1), (2, 2), (3, 4)}. 1   2 3   4

Reflexive: The relation represented by a digraph is reflexive if and only if there is a loop at every vertex. Irreflexive: The relation represented by a digraph is irreflexive if and only if there is not a loop at any vertex. Symmetric: The relation represented by a digraph is symmetric if and only if all arrows (other than loops) come in pairs with reverse direction. Antisymmetric: The relation represented by a digraph is antisymmetric if and only if there are no pairs of arrows with reverse direction. Transitive: The relation represented by a digraph is transitive if and only if there is an edge from a to b whenever there is a path from a to b for all nodes a and b.