SlideShare a Scribd company logo
1 of 44
Representing Relations
Lecture 14, CMSC 56
Allyn Joy D. Calcaben
Representing Relations
using Digraphs
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.
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.
Example
What is 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 }?
Solution
What is 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 }?
1 2
34
Example
What is the ordered pairs in the
relation R represented by the
directed graph on the right?
1 2
34
Solution
What is the ordered pairs in the relation R
represented by the directed graph below?
1 2
34
The ordered pairs (x, y) in the relation are;
R = { (1, 3), (1, 4), (2, 1), (2, 2), (2, 3),
(3, 1), (3, 3), (4, 1), (4, 3) }
Reflexive Digraphs
A relation is reflexive if and only if there is a loop at every vertex
of the directed graph, so that every ordered pair of the form (x, x)
occurs in the relation.
Symmetric Digraphs
A relation is symmetric if and only if for every edge between
distinct vertices in its digraph there is an edge in the opposite
direction, so that (y, x) is in the relation whenever (x, y) is in
opposite directions between distinct vertices.
Antisymmetric Digraphs
A relation is antisymmetric if and only if there are never two
edges in opposite directions between distinct vertices.
Transitive Digraphs
A relation is transitive if and only if whenever there is an edge
from a vertex x to a vertex y and an edge from a vertex y to a
vertex z, there is an edge from x to z.
TAKE NOTE:
A symmetric relation can be represented by an undirected
graph, which is a graph where edges do not have directions.
Example
a b
dc
Determine whether the relations for
the directed graph are reflexive,
symmetric, antisymmetric, and/or
transitive.
Solution
a b
dc
Determine whether the relations for the
directed graph are reflexive, symmetric,
antisymmetric, and/or transitive.
Not Reflexive, since loops are not
present at all the vertices of the directed
graph.
Symmetric and not antisymmetric,
because every edge between distinct
vertices is accompanied by an edge in
the opposite direction.
Not transitive, (c, a) and (a, b) belong to
the directed graph, but (c, b) does not.
Quiz (1/8 size Paper)
a
b c
Determine whether the relations for
the directed graph are reflexive,
symmetric, antisymmetric, and/or
transitive.
Solution
a
b c
Determine whether the relations for the
directed graph are reflexive, symmetric,
antisymmetric, and/or transitive.
Reflexive, since there are loops at every
vertex of the directed graph.
Neither Symmetric nor antisymmetric,
because there is an edge from a to b but
not one from b to a, but there are edges
in both directions connecting b and c.
Not transitive, (a, b) and (b, c) belong to
the directed graph, but (a, c) does not.
Representing Relations
using Matrices
Representing Relations using Matrices
A relation between finite sets can be represented using a zero-one
matrix. Suppose that R is a relation from A = { a1, a2, a3, . . . , am }
to B = { b1, b2, b3, . . . , bm } .
The relation R can be represented by the matrix MR = [mij], where
1 if (ai , bj) ∈ R
mij =
0 if (ai , bj) ∉ R
Example
Let A = { a1, a2, a3 } and B = { b1, b2, b3, b4, b5 }. Which ordered pairs
are in the relation R represented by the matrix?
0 1 0 0 0
MR = 1 0 1 1 0
1 0 1 0 1
Solution
Let A = { a1, a2, a3 } and B = { b1, b2, b3, b4, b5 }.
Which ordered pairs are in the relation R
represented by the matrix?
0 1 0 0 0
MR
= 1 0 1 1 0
1 0 1 0 1
Since R consists of those ordered pairs
(ai, bj) with mij = 1, it follows that:
R = { (a1, b2), (a2, b1), (a2, b3), (a2, b4),
(a3, b1), (a3, b3), (a3, b5),}
Reflexive Matrix
A relation is reflexive if and only if mii = 1, for i = 1, 2, . . ., n. In
other words, if all elements on the main diagonal of MR are equal
to 1.
Symmetric Matrix
A relation is symmetric if and only if mji = mij. This means that it
must be either mji = 1 whenever mij = 1 or mji = 0 whenever mij = 0.
Antisymmetric Matrix
A relation is antisymmetric if and only if mij = 1 with i ≠ j,
then mji = 0. Or in other words, either mij = 0 or mji = 0 when i ≠ j.
Example
Suppose that the relation R on a set is represented by the matrix
Is R reflexive, symmetric, and/or antisymmetric?
1 1 0
MR = 1 1 1
0 1 1
Solution
Suppose that the relation R on a set is
represented by the matrix
Is R reflexive, symmetric, and antisymmetric?
1 1 0
MR = 1 1 1
0 1 1
Reflexive, since all the diagonal
elements of the matrix are equal
to 1.
Symmetric, because mji = mij = 1.
Not antisymmetric, it is easy to
see that neither mij = 0 nor mji = 0
when i ≠ j.
Union of Matrices
The matrix representing the union of two or more relations has a
1 in the positions where either MR1
or MR2
has a 1.
MR1 U R2
= MR1
V MR2
Intersection of Matrices
The matrix representing the intersection of two or more relations
has a 1 in the positions where both MR1
and MR2
have a 1.
MR1 ∩ R2
= MR1
ꓥ MR2
Example
Suppose that the relation R1 and R2 on a set is represented by the
matrix
What are the matrices representing R1 U R2 and R1 ∩ R2 ?
1 0 1
MR1
= 1 0 0
0 1 0
1 0 1
MR2
= 0 1 1
1 0 0
Suppose that the relation R1 and R2 on a set is
represented by the matrix
What are the matrices representing R1 U R2 and
R1 ∩ R2 ?
Example
1 0 1
MR1
= 1 0 0
0 1 0
1 0 1
MR2
= 0 1 1
1 0 0
1 0 1
MR1 U R2
= 1 1 1
1 1 0
1 0 1
MR1 ∩ R2
= 0 0 0
0 0 0
Composite of Matrices
Suppose that A, B, and C have m, n, and p elements, respectively. Let
the zero-one matrices for S ◦ R, R, and S be MS ◦ R = [tij], MR = [rij], and
MS = [sij]. The ordered pair (ai, cj) belongs to S ◦ R if and only if there
is an element bk such that (ai, bk) belongs to R and (bk, cj) belongs to
S. It follows that tij = 1 if and only if rik = skj = 1 for some k.
MS ◦ R = MR
⨀ MS
Example
Find the matrix representing the relations S ◦ R, where the
matrices representing R and S are
1 0 1
MR = 1 1 0
0 0 0
0 1 0
MS = 0 0 1
1 0 1
Find the matrix representing the relations S ◦ R,
where the matrices representing R and S are
Solution
1 0 1
MR = 1 1 0
0 0 0
0 1 0
MS = 0 0 1
1 0 1
1 1 1
MS ◦ R = 0 1 1
0 0 0
The matrix for S ◦ R is
Power of Matrices
The matrix representing the composite of two relations can be
used to find the matrix for MRn.
MRn = MR
[n]
Example
Find the matrix representing the relation R2, where the matrix
representing R is
0 1 0
MR = 0 1 1
1 0 0
Solution
The matrix for R2 is
0 1 0
MR = 0 1 1
1 0 0
Find the matrix representing the relation R2,
where the matrix representing R is
0 1 1
MR = 1 1 1
0 1 0
Any Question?
EXAM RESULT
CMSC 56 2nd LE Top 3 Scorers
79.0% Samson, Aron Miles
78.0% Honeyman, John
75.5% Gavieta, Don Michael
W Section
CMSC 56 2nd LE Top 3 Scorers
79.0% Samson, Aron Miles
78.0% Honeyman, John
75.5% Gavieta, Don Michael
W Section
CMSC 56 2nd LE Top 3 Scorers
79.0% Samson, Aron Miles
78.0% Honeyman, John
75.5% Gavieta, Don Michael
W Section
CMSC 56 2nd LE Top 3 Scorers
79.0% Samson, Aron Miles
78.0% Honeyman, John
75.5% Gavieta, Don Michael
W Section
79.0% Samson, Aron Miles
78.0% Honeyman, John
75.5% Gavieta, Don Michael
74.0% Ngo, Ma. Gishelle Anne
72.0% Castañeda, Jayvee
CMSC 56 2nd LE Top 5 Scorers
Overall

More Related Content

What's hot

Applications of linear algebra in computer science
Applications of linear algebra in computer scienceApplications of linear algebra in computer science
Applications of linear algebra in computer scienceArnob Khan
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics NANDINI SHARMA
 
Mathematical Induction
Mathematical InductionMathematical Induction
Mathematical InductionEdelyn Cagas
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relationsnszakir
 
CMSC 56 | Lecture 9: Functions Representations
CMSC 56 | Lecture 9: Functions RepresentationsCMSC 56 | Lecture 9: Functions Representations
CMSC 56 | Lecture 9: Functions Representationsallyn joy calcaben
 
CMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program Correctness
CMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program CorrectnessCMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program Correctness
CMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program Correctnessallyn joy calcaben
 
CMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their PropertiesCMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their Propertiesallyn joy calcaben
 

What's hot (20)

Applications of linear algebra in computer science
Applications of linear algebra in computer scienceApplications of linear algebra in computer science
Applications of linear algebra in computer science
 
Generating function
Generating functionGenerating function
Generating function
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics
 
Mathematical Induction
Mathematical InductionMathematical Induction
Mathematical Induction
 
LinearAlgebra.ppt
LinearAlgebra.pptLinearAlgebra.ppt
LinearAlgebra.ppt
 
lattice
 lattice lattice
lattice
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relations
 
Relations
RelationsRelations
Relations
 
Sets, functions and groups
Sets, functions and groupsSets, functions and groups
Sets, functions and groups
 
CMSC 56 | Lecture 9: Functions Representations
CMSC 56 | Lecture 9: Functions RepresentationsCMSC 56 | Lecture 9: Functions Representations
CMSC 56 | Lecture 9: Functions Representations
 
Pigeon hole principle
Pigeon hole principlePigeon hole principle
Pigeon hole principle
 
Number Theory - Lesson 1 - Introduction to Number Theory
Number Theory - Lesson 1 - Introduction to Number TheoryNumber Theory - Lesson 1 - Introduction to Number Theory
Number Theory - Lesson 1 - Introduction to Number Theory
 
Hamilton path and euler path
Hamilton path and euler pathHamilton path and euler path
Hamilton path and euler path
 
CMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program Correctness
CMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program CorrectnessCMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program Correctness
CMSC 56 | Lecture 12: Recursive Definition & Algorithms, and Program Correctness
 
Set theory
Set theorySet theory
Set theory
 
Introductions to Relations
Introductions to RelationsIntroductions to Relations
Introductions to Relations
 
CMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their PropertiesCMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their Properties
 
MATCHING GRAPH THEORY
MATCHING GRAPH THEORYMATCHING GRAPH THEORY
MATCHING GRAPH THEORY
 
Vector space
Vector spaceVector space
Vector space
 

Similar to CMSC 56 | Lecture 14: Representing Relations

Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsWongyos Keardsri
 
Power point for Theory of computation and detail
Power point for Theory of computation and detailPower point for Theory of computation and detail
Power point for Theory of computation and detailNivaTripathy1
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Relational Algebra (1).pptx
Relational Algebra (1).pptxRelational Algebra (1).pptx
Relational Algebra (1).pptxSarowarSuman
 
Presentation2 vijayan pillai
Presentation2 vijayan pillaiPresentation2 vijayan pillai
Presentation2 vijayan pillaiunni2012
 
basics of autometa theory for beginner .
basics of autometa theory for beginner .basics of autometa theory for beginner .
basics of autometa theory for beginner .NivaTripathy1
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfSanjanaAdri
 
Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1RAHUL SINGH
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxRockyIslam5
 

Similar to CMSC 56 | Lecture 14: Representing Relations (20)

Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 Relations
 
Relations
RelationsRelations
Relations
 
Relations
RelationsRelations
Relations
 
Power point for Theory of computation and detail
Power point for Theory of computation and detailPower point for Theory of computation and detail
Power point for Theory of computation and detail
 
Per5 relasi
Per5 relasiPer5 relasi
Per5 relasi
 
Relations
RelationsRelations
Relations
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Relational Algebra (1).pptx
Relational Algebra (1).pptxRelational Algebra (1).pptx
Relational Algebra (1).pptx
 
Relation in discreate
Relation in discreateRelation in discreate
Relation in discreate
 
Presentation2 vijayan pillai
Presentation2 vijayan pillaiPresentation2 vijayan pillai
Presentation2 vijayan pillai
 
basics of autometa theory for beginner .
basics of autometa theory for beginner .basics of autometa theory for beginner .
basics of autometa theory for beginner .
 
Lemh101
Lemh101Lemh101
Lemh101
 
Relations
RelationsRelations
Relations
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdf
 
Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptx
 
Chap04 01
Chap04 01Chap04 01
Chap04 01
 
Math n Statistic
Math n StatisticMath n Statistic
Math n Statistic
 

More from allyn joy calcaben

CMSC 56 | Lecture 17: Matrices
CMSC 56 | Lecture 17: MatricesCMSC 56 | Lecture 17: Matrices
CMSC 56 | Lecture 17: Matricesallyn joy calcaben
 
CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relationsallyn joy calcaben
 
CMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical InductionCMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical Inductionallyn joy calcaben
 
CMSC 56 | Lecture 10: Integer Representations & Algorithms
CMSC 56 | Lecture 10: Integer Representations & AlgorithmsCMSC 56 | Lecture 10: Integer Representations & Algorithms
CMSC 56 | Lecture 10: Integer Representations & Algorithmsallyn joy calcaben
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functionsallyn joy calcaben
 
CMSC 56 | Lecture 4: Rules of Inference
CMSC 56 | Lecture 4: Rules of InferenceCMSC 56 | Lecture 4: Rules of Inference
CMSC 56 | Lecture 4: Rules of Inferenceallyn joy calcaben
 
CMSC 56 | Lecture 6: Sets & Set Operations
CMSC 56 | Lecture 6: Sets & Set OperationsCMSC 56 | Lecture 6: Sets & Set Operations
CMSC 56 | Lecture 6: Sets & Set Operationsallyn joy calcaben
 
CMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and StrategyCMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and Strategyallyn joy calcaben
 
CMSC 56 | Lecture 3: Predicates & Quantifiers
CMSC 56 | Lecture 3: Predicates & QuantifiersCMSC 56 | Lecture 3: Predicates & Quantifiers
CMSC 56 | Lecture 3: Predicates & Quantifiersallyn joy calcaben
 
CMSC 56 | Lecture 2: Propositional Equivalences
CMSC 56 | Lecture 2: Propositional EquivalencesCMSC 56 | Lecture 2: Propositional Equivalences
CMSC 56 | Lecture 2: Propositional Equivalencesallyn joy calcaben
 
CMSC 56 | Lecture 1: Propositional Logic
CMSC 56 | Lecture 1: Propositional LogicCMSC 56 | Lecture 1: Propositional Logic
CMSC 56 | Lecture 1: Propositional Logicallyn joy calcaben
 
La Solidaridad and the Propaganda Movement
La Solidaridad and the Propaganda MovementLa Solidaridad and the Propaganda Movement
La Solidaridad and the Propaganda Movementallyn joy calcaben
 
Computer Vision: Feature matching with RANSAC Algorithm
Computer Vision: Feature matching with RANSAC AlgorithmComputer Vision: Feature matching with RANSAC Algorithm
Computer Vision: Feature matching with RANSAC Algorithmallyn joy calcaben
 
Chapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements iiChapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements iiallyn joy calcaben
 

More from allyn joy calcaben (15)

CMSC 56 | Lecture 17: Matrices
CMSC 56 | Lecture 17: MatricesCMSC 56 | Lecture 17: Matrices
CMSC 56 | Lecture 17: Matrices
 
CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relations
 
CMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical InductionCMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical Induction
 
CMSC 56 | Lecture 10: Integer Representations & Algorithms
CMSC 56 | Lecture 10: Integer Representations & AlgorithmsCMSC 56 | Lecture 10: Integer Representations & Algorithms
CMSC 56 | Lecture 10: Integer Representations & Algorithms
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functions
 
CMSC 56 | Lecture 4: Rules of Inference
CMSC 56 | Lecture 4: Rules of InferenceCMSC 56 | Lecture 4: Rules of Inference
CMSC 56 | Lecture 4: Rules of Inference
 
CMSC 56 | Lecture 6: Sets & Set Operations
CMSC 56 | Lecture 6: Sets & Set OperationsCMSC 56 | Lecture 6: Sets & Set Operations
CMSC 56 | Lecture 6: Sets & Set Operations
 
CMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and StrategyCMSC 56 | Lecture 5: Proofs Methods and Strategy
CMSC 56 | Lecture 5: Proofs Methods and Strategy
 
CMSC 56 | Lecture 3: Predicates & Quantifiers
CMSC 56 | Lecture 3: Predicates & QuantifiersCMSC 56 | Lecture 3: Predicates & Quantifiers
CMSC 56 | Lecture 3: Predicates & Quantifiers
 
CMSC 56 | Lecture 2: Propositional Equivalences
CMSC 56 | Lecture 2: Propositional EquivalencesCMSC 56 | Lecture 2: Propositional Equivalences
CMSC 56 | Lecture 2: Propositional Equivalences
 
CMSC 56 | Lecture 1: Propositional Logic
CMSC 56 | Lecture 1: Propositional LogicCMSC 56 | Lecture 1: Propositional Logic
CMSC 56 | Lecture 1: Propositional Logic
 
La Solidaridad and the Propaganda Movement
La Solidaridad and the Propaganda MovementLa Solidaridad and the Propaganda Movement
La Solidaridad and the Propaganda Movement
 
Computer Vision: Feature matching with RANSAC Algorithm
Computer Vision: Feature matching with RANSAC AlgorithmComputer Vision: Feature matching with RANSAC Algorithm
Computer Vision: Feature matching with RANSAC Algorithm
 
Chapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements iiChapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements ii
 
#11 osteoporosis
#11 osteoporosis#11 osteoporosis
#11 osteoporosis
 

Recently uploaded

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 

Recently uploaded (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 

CMSC 56 | Lecture 14: Representing Relations

  • 1. Representing Relations Lecture 14, CMSC 56 Allyn Joy D. Calcaben
  • 3. 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.
  • 4. 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.
  • 5. Example What is 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 }?
  • 6. Solution What is 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 }? 1 2 34
  • 7. Example What is the ordered pairs in the relation R represented by the directed graph on the right? 1 2 34
  • 8. Solution What is the ordered pairs in the relation R represented by the directed graph below? 1 2 34 The ordered pairs (x, y) in the relation are; R = { (1, 3), (1, 4), (2, 1), (2, 2), (2, 3), (3, 1), (3, 3), (4, 1), (4, 3) }
  • 9. Reflexive Digraphs A relation is reflexive if and only if there is a loop at every vertex of the directed graph, so that every ordered pair of the form (x, x) occurs in the relation.
  • 10. Symmetric Digraphs A relation is symmetric if and only if for every edge between distinct vertices in its digraph there is an edge in the opposite direction, so that (y, x) is in the relation whenever (x, y) is in opposite directions between distinct vertices.
  • 11. Antisymmetric Digraphs A relation is antisymmetric if and only if there are never two edges in opposite directions between distinct vertices.
  • 12. Transitive Digraphs A relation is transitive if and only if whenever there is an edge from a vertex x to a vertex y and an edge from a vertex y to a vertex z, there is an edge from x to z.
  • 13. TAKE NOTE: A symmetric relation can be represented by an undirected graph, which is a graph where edges do not have directions.
  • 14. Example a b dc Determine whether the relations for the directed graph are reflexive, symmetric, antisymmetric, and/or transitive.
  • 15. Solution a b dc Determine whether the relations for the directed graph are reflexive, symmetric, antisymmetric, and/or transitive. Not Reflexive, since loops are not present at all the vertices of the directed graph. Symmetric and not antisymmetric, because every edge between distinct vertices is accompanied by an edge in the opposite direction. Not transitive, (c, a) and (a, b) belong to the directed graph, but (c, b) does not.
  • 16. Quiz (1/8 size Paper) a b c Determine whether the relations for the directed graph are reflexive, symmetric, antisymmetric, and/or transitive.
  • 17. Solution a b c Determine whether the relations for the directed graph are reflexive, symmetric, antisymmetric, and/or transitive. Reflexive, since there are loops at every vertex of the directed graph. Neither Symmetric nor antisymmetric, because there is an edge from a to b but not one from b to a, but there are edges in both directions connecting b and c. Not transitive, (a, b) and (b, c) belong to the directed graph, but (a, c) does not.
  • 19. Representing Relations using Matrices A relation between finite sets can be represented using a zero-one matrix. Suppose that R is a relation from A = { a1, a2, a3, . . . , am } to B = { b1, b2, b3, . . . , bm } . The relation R can be represented by the matrix MR = [mij], where 1 if (ai , bj) ∈ R mij = 0 if (ai , bj) ∉ R
  • 20. Example Let A = { a1, a2, a3 } and B = { b1, b2, b3, b4, b5 }. Which ordered pairs are in the relation R represented by the matrix? 0 1 0 0 0 MR = 1 0 1 1 0 1 0 1 0 1
  • 21. Solution Let A = { a1, a2, a3 } and B = { b1, b2, b3, b4, b5 }. Which ordered pairs are in the relation R represented by the matrix? 0 1 0 0 0 MR = 1 0 1 1 0 1 0 1 0 1 Since R consists of those ordered pairs (ai, bj) with mij = 1, it follows that: R = { (a1, b2), (a2, b1), (a2, b3), (a2, b4), (a3, b1), (a3, b3), (a3, b5),}
  • 22. Reflexive Matrix A relation is reflexive if and only if mii = 1, for i = 1, 2, . . ., n. In other words, if all elements on the main diagonal of MR are equal to 1.
  • 23. Symmetric Matrix A relation is symmetric if and only if mji = mij. This means that it must be either mji = 1 whenever mij = 1 or mji = 0 whenever mij = 0.
  • 24. Antisymmetric Matrix A relation is antisymmetric if and only if mij = 1 with i ≠ j, then mji = 0. Or in other words, either mij = 0 or mji = 0 when i ≠ j.
  • 25. Example Suppose that the relation R on a set is represented by the matrix Is R reflexive, symmetric, and/or antisymmetric? 1 1 0 MR = 1 1 1 0 1 1
  • 26. Solution Suppose that the relation R on a set is represented by the matrix Is R reflexive, symmetric, and antisymmetric? 1 1 0 MR = 1 1 1 0 1 1 Reflexive, since all the diagonal elements of the matrix are equal to 1. Symmetric, because mji = mij = 1. Not antisymmetric, it is easy to see that neither mij = 0 nor mji = 0 when i ≠ j.
  • 27. Union of Matrices The matrix representing the union of two or more relations has a 1 in the positions where either MR1 or MR2 has a 1. MR1 U R2 = MR1 V MR2
  • 28. Intersection of Matrices The matrix representing the intersection of two or more relations has a 1 in the positions where both MR1 and MR2 have a 1. MR1 ∩ R2 = MR1 ꓥ MR2
  • 29. Example Suppose that the relation R1 and R2 on a set is represented by the matrix What are the matrices representing R1 U R2 and R1 ∩ R2 ? 1 0 1 MR1 = 1 0 0 0 1 0 1 0 1 MR2 = 0 1 1 1 0 0
  • 30. Suppose that the relation R1 and R2 on a set is represented by the matrix What are the matrices representing R1 U R2 and R1 ∩ R2 ? Example 1 0 1 MR1 = 1 0 0 0 1 0 1 0 1 MR2 = 0 1 1 1 0 0 1 0 1 MR1 U R2 = 1 1 1 1 1 0 1 0 1 MR1 ∩ R2 = 0 0 0 0 0 0
  • 31. Composite of Matrices Suppose that A, B, and C have m, n, and p elements, respectively. Let the zero-one matrices for S ◦ R, R, and S be MS ◦ R = [tij], MR = [rij], and MS = [sij]. The ordered pair (ai, cj) belongs to S ◦ R if and only if there is an element bk such that (ai, bk) belongs to R and (bk, cj) belongs to S. It follows that tij = 1 if and only if rik = skj = 1 for some k. MS ◦ R = MR ⨀ MS
  • 32. Example Find the matrix representing the relations S ◦ R, where the matrices representing R and S are 1 0 1 MR = 1 1 0 0 0 0 0 1 0 MS = 0 0 1 1 0 1
  • 33. Find the matrix representing the relations S ◦ R, where the matrices representing R and S are Solution 1 0 1 MR = 1 1 0 0 0 0 0 1 0 MS = 0 0 1 1 0 1 1 1 1 MS ◦ R = 0 1 1 0 0 0 The matrix for S ◦ R is
  • 34. Power of Matrices The matrix representing the composite of two relations can be used to find the matrix for MRn. MRn = MR [n]
  • 35. Example Find the matrix representing the relation R2, where the matrix representing R is 0 1 0 MR = 0 1 1 1 0 0
  • 36. Solution The matrix for R2 is 0 1 0 MR = 0 1 1 1 0 0 Find the matrix representing the relation R2, where the matrix representing R is 0 1 1 MR = 1 1 1 0 1 0
  • 39.
  • 40. CMSC 56 2nd LE Top 3 Scorers 79.0% Samson, Aron Miles 78.0% Honeyman, John 75.5% Gavieta, Don Michael W Section
  • 41. CMSC 56 2nd LE Top 3 Scorers 79.0% Samson, Aron Miles 78.0% Honeyman, John 75.5% Gavieta, Don Michael W Section
  • 42. CMSC 56 2nd LE Top 3 Scorers 79.0% Samson, Aron Miles 78.0% Honeyman, John 75.5% Gavieta, Don Michael W Section
  • 43. CMSC 56 2nd LE Top 3 Scorers 79.0% Samson, Aron Miles 78.0% Honeyman, John 75.5% Gavieta, Don Michael W Section
  • 44. 79.0% Samson, Aron Miles 78.0% Honeyman, John 75.5% Gavieta, Don Michael 74.0% Ngo, Ma. Gishelle Anne 72.0% Castañeda, Jayvee CMSC 56 2nd LE Top 5 Scorers Overall

Editor's Notes

  1. The directed graph representing a relation can be used to determine whether the relation has various properties.
  2. The directed graph representing a relation can be used to determine whether the relation has various properties.
  3. The directed graph representing a relation can be used to determine whether the relation has various properties.
  4. The directed graph representing a relation can be used to determine whether the relation has various properties.
  5. The directed graph representing a relation can be used to determine whether the relation has various properties.
  6. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.
  7. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.
  8. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.
  9. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.
  10. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.
  11. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.
  12. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.
  13. The matrix of a relation on a set, which is a square matrix, can be used to determine whether the relation has certain properties.