SlideShare a Scribd company logo
1 of 15
Download to read offline
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
1
Relations:
DEFINITION 1:
Let A and B be sets. A binary relation from A to B is a subset of A × B.
Example 1:
Let A = {0, 1, 2} and B = {a, b}. Then {(0, a), (0, b), (1, a), (2, b)} is a relation from A to B. This means,
for instance, that 0 R a, but that 1 b. Relations can be represented graphically, as shown in Figure
1, using arrows to represent ordered pairs. Another way to represent this relation is to use a table,
which is also done in Figure 1.
Figure 1: Displaying the Ordered Pairs in the Relation R from Example 1.
Example 2:
Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R = {(a, b) | a divides b}?
Solution:
Because (a, b) is in R if and only if a and b are positive integers not exceeding 4 such that a divides b,
we see that
R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.
The pairs in this relation are displayed both graphically and in tabular form in Figure 2.
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
2
Figure 2: Displaying the Ordered Pairs in the Relation R from Example 2:
Example 3:
Consider these relations on the set of integers:
R1 = {(a, b) | a ≤ b},
R2 = {(a, b) | a > b},
R3 = {(a, b) | a = b or a = −b},
R4 = {(a, b) | a = b},
R5 = {(a, b) | a = b + 1},
R6 = {(a, b) | a + b ≤ 3}.
Which of these relations contain each of the pairs (1, 1), (1, 2), (2, 1), (1,−1), and (2, 2)?
Solution:
The pair (1, 1) is in R1, R3, R4, and R6; (1, 2) is in R1 and R6; (2, 1) is in R2, R5, and R6; (1,−1) is in R2,
R3, and R6; and finally, (2, 2) is in R1, R3, and R4.
DEFINITION 2:
A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A.
Example 4:
Consider the following relations on {1, 2, 3, 4}:
R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
3
R6 = {(3, 4)}.
Which of these relations are reflexive?
Solution:
The relations R3 and R5 are reflexive because they both contain all pairs of the form (a, a), namely,
(1, 1), (2, 2), (3, 3), and (4, 4). The other relations are not reflexive because they do not contain all of
these ordered pairs. In particular, R1, R2, R4, and R6 are not reflexive because (3, 3) is not in any of
these relations.
DEFINITION 3:
A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A. A
relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called
antisymmetric.
Example 5:
Which of the relations from Example 4 are symmetric and which are antisymmetric?
Solution:
The relations R2 and R3 are symmetric, because in each case (b, a) belongs to the relation whenever
(a, b) does. For R2, the only thing to check is that both (2, 1) and (1, 2) are in the relation. For R3, it is
necessary to check that both (1, 2) and (2, 1) belong to the relation, and (1, 4) and (4, 1) belong to
the relation. The reader should verify that none of the other relations is symmetric. This is done by
finding a pair (a, b) such that it is in the relation but (b, a) is not.
R4, R5, and R6 are all antisymmetric. For each of these relations there is no pair of elements a and b
with a ≠ b such that both (a, b) and (b, a) belong to the relation. The reader should verify that none
of the other relations is antisymmetric. This is done by finding a pair (a, b) with a ≠ b such that (a, b)
and (b, a) are both in the relation.
DEFINITION 4:
A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R, for
all a, b, c ∈ A.
Example 6:
Which of the relations in Example 4 are transitive?
Solution:
R4, R5, and R6 are transitive. For each of these relations, we can show that it is transitive by verifying
that if (a, b) and (b, c) belong to this relation, then (a, c) also does. For instance, R4 is transitive,
because (3, 2) and (2, 1), (4, 2) and (2, 1), (4, 3) and (3, 1), and (4, 3) and (3, 2) are the only such sets
of pairs, and (3, 1), (4, 1), and (4, 2) belong to R4. The reader should verify that R5 and R6 are
transitive.
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
4
R1 is not transitive because (3, 4) and (4, 1) belong to R1, but (3, 1) does not. R2 is not transitive
because (2, 1) and (1, 2) belong to R2, but (2, 2) does not. R3 is not transitive because (4, 1) and (1,
2) belong to R3, but (4, 2) does not.
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
5
Graphs:
DEFINITION 1:
A graph G = (V,E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each
edge has either one or two vertices associated with it, called its endpoints. An edge is said to
connect its endpoints.
Simple graph:
A graph in which each edge connects two different vertices and where no two edges connect the
same pair of vertices is called a simple graph. Figure 1 shows a simple graph.
Figure 1: A computer network which is an example of simple graph
Multigraphs:
Graphs that may have multiple edges connecting the same vertices are called multigraphs. Figure 2
shows a Multigraph.
Figure 2: A computer network forms a multigraph
Pseudographs:
Graphs that may include loops are called pseudographs. Figure 3 shows a pseudograph.
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
6
Figure 3: A computer network forms a pseudograph
DEFINITION 2:
A directed graph (or digraph) (V ,E) consists of a nonempty set of vertices V and a set of directed
edges (or arcs) E. Each directed edge is associated with an ordered pair of vertices. The directed
edge associated with the ordered pair (u, v) is said to start at u and end at v. Figure 4 shows a simple
directed graph.
Figure 4: A communication network forms a simple directed graph
Directed Multigraph:
Directed graph that have multiple directed edges are called directed multigraph. Figure 5 shows a
directed multigraph.
Figure 5: A computer network forms a directed multigraph
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
7
Graph Overview:
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
8
Graph Terminology:
DEFINITION 1:
The degree of a vertex in an undirected graph is the number of edges incident with it, except that a
loop at a vertex contributes twice to the degree of that vertex. The degree of the vertex v is denoted
by deg(v).
EXAMPLE 1:
What are the degrees of the vertices in the graphs G and H displayed in Figure 1?
Solution:
In G, deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d ) = 1, deg(e) = 3, and deg(g) = 0.
In H, deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, and deg(d ) = 5.
A vertex of degree zero is called isolated. Vertex g in graph G in Example 1 is isolated.
A vertex is pendant if and only if it has degree one. Vertex d in graph G in Example 1 is pendant.
THEOREM 1: THE HANDSHAKING THEOREM
Let G = (V ,E) be an undirected graph with m edges. Then
EXAMPLE 2:
How many edges are there in a graph with 10 vertices each of degree six?
Solution:
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
9
Because the sum of the degrees of the vertices is 6 × 10 = 60, it follows that 2m = 60 where m is the
number of edges. Therefore, m = 30.
DEFINITION 2:
In a graph with directed edges the in-degree of a vertex v, denoted by deg− (v), is the number of
edges with v as their terminal vertex. The out-degree of v, denoted by deg+ (v), is the number of
edges with v as their initial vertex.
EXAMPLE 3:
Find the in-degree and out-degree of each vertex in the graph G with directed edges shown in Figure
2.
Figure 2: The directed graph G
Solution:
The in-degrees in G are: deg− (a) = 2, deg− (b) = 2, deg− (c) = 3, deg− (d) = 2, deg− (e) = 3, and deg−
(f) = 0.
The out-degrees are deg+ (a) = 4, deg+ (b) = 1, deg+ (c) = 2, deg+ (d) = 2, deg+ (e) = 3, and deg+ (f ) =
0.
THEOREM 2:
Let G = (V ,E) be a graph with directed edges. Then
Some special simple graphs:
Complete Graphs:
A complete graph on n vertices, denoted by Kn, is a simple graph that contains exactly one edge
between each pair of distinct vertices. The graphs Kn, for n = 1, 2, 3, 4, 5, 6, are displayed in Figure 3.
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
10
Figure 3: The Graphs Kn for 1 ≤ n ≤ 6
Cycles:
A cycle Cn, n ≥ 3, consists of n vertices v1, v2, . . . , vn and edges {v1, v2}, {v2, v3}, . . . , {vn−1, vn}, and
{vn, v1}. The cycles C3, C4, C5, and C6 are displayed in Figure 4.
FIGURE 4: The Cycles C3, C4, C5, and C6
Wheels:
We obtain a wheel Wn when we add an additional vertex to a cycle Cn, for n ≥ 3, and connect this
new vertex to each of the n vertices in Cn, by new edges. The wheels W3, W4, W5, and W6 are
displayed in Figure 5.
FIGURE 5: The Wheels W3, W4, W5, and W6
DEFINITION 3:
A simple graph G is called bipartite if its vertex set V can be partitioned into two disjoint sets V1 and
V2 such that every edge in the graph connects a vertex in V1 and a vertex in V2.
EXAMPLE 4:
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
11
C6 is bipartite, as shown in Figure 6, because its vertex set can be partitioned into the two sets V1 =
{v1, v3, v5} and V2 = {v2, v4, v6}, and every edge of C6 connects a vertex in V1 and a vertex in V2.
FIGURE 6: Showing that C6 is bipartite
EXAMPLE 5:
Are the graphs G and H displayed in Figure 7 bipartite?
FIGURE 7: The Undirected Graphs G and H
Solution:
Graph G is bipartite because its vertex set is the union of two disjoint sets, {a, b, d} and {c, e, f, g},
and each edge connects a vertex in one of these subsets to a vertex in the other subset.
Graph H is not bipartite because its vertex set cannot be partitioned into two subsets so that edges
do not connect two vertices from the same subset.
Complete Bipartite Graphs:
A complete bipartite graph Km,n is a graph that has its vertex set partitioned into two subsets of m
and n vertices, respectively with an edge between two vertices if and only if one vertex is in the first
subset and the other vertex is in the second subset. The complete bipartite graphs K2,3, K3,3, K3,5,
and K2,6 are displayed in Figure 8.
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
12
Figure 8: Some Complete Bipartite Graphs
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
13
Representing Graphs:
There are two methods to represent graphs:
a. Adjacency list
b. Adjacency matrix
Example 1:
Use adjacency lists to describe the simple graph given in Figure 1.
Solution:
Table 1 lists those vertices adjacent to each of the vertices of the graph.
Example 2:
Use adjacency lists to describe the directed graph given in Figure 2.
Solution:
Table 2 represents the directed graph shown in Figure 2.
Example 3:
Use an adjacency matrix to represent the graph shown in Figure 3.
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
14
Figure 3: Simple Graph
Solution:
We order the vertices as a, b, c, d. The matrix representing this graph is
Example 4:
Draw a graph with the adjacency matrix
with respect to the ordering of vertices a, b, c, d.
Solution:
A graph with this adjacency matrix is shown in Figure 4.
Figure 4: Adjacency matrix of example 4
Example 5:
Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka
15
Use an adjacency matrix to represent the pseudograph shown in Figure 5.
Figure 5: A pseudograph
Solution:
The adjacency matrix using the ordering of vertices a, b, c, d is

More Related Content

What's hot

Relations
RelationsRelations
RelationsGaditek
 
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingBCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingRai University
 
relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83
relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83
relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83Dewi Dewi
 
Relations and functions
Relations and functions Relations and functions
Relations and functions Seyid Kadher
 
CBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasCBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasParth Kshirsagar
 
DISTANCE FORMULA (GRADE 10 MATH)
DISTANCE FORMULA (GRADE 10 MATH)DISTANCE FORMULA (GRADE 10 MATH)
DISTANCE FORMULA (GRADE 10 MATH)daisyree medino
 
Diploma_Semester-II_Advanced Mathematics_Complex number
Diploma_Semester-II_Advanced Mathematics_Complex numberDiploma_Semester-II_Advanced Mathematics_Complex number
Diploma_Semester-II_Advanced Mathematics_Complex numberRai University
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Domain and range of a RELATION
Domain and range of a RELATIONDomain and range of a RELATION
Domain and range of a RELATIONJanak Singh saud
 
Pythagorean theorem and distance formula powerpoint1
Pythagorean theorem and distance formula powerpoint1Pythagorean theorem and distance formula powerpoint1
Pythagorean theorem and distance formula powerpoint140505903
 
Application of graph theory in drug design
Application of graph theory in drug designApplication of graph theory in drug design
Application of graph theory in drug designReihaneh Safavi
 
Mathematics 9 Radical Expressions (1)
Mathematics 9 Radical Expressions (1)Mathematics 9 Radical Expressions (1)
Mathematics 9 Radical Expressions (1)Juan Miguel Palero
 
May 5, 2014
May 5, 2014May 5, 2014
May 5, 2014khyps13
 

What's hot (20)

Relations
RelationsRelations
Relations
 
Relations
RelationsRelations
Relations
 
Relations
RelationsRelations
Relations
 
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingBCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
 
MIDPOINT FORMULA
MIDPOINT FORMULAMIDPOINT FORMULA
MIDPOINT FORMULA
 
relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83
relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83
relasi dan fungsi kelompok 4 smpn 3 cikarang timur kelas 83
 
Relations and functions
Relations and functions Relations and functions
Relations and functions
 
CBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasCBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulas
 
DISTANCE FORMULA (GRADE 10 MATH)
DISTANCE FORMULA (GRADE 10 MATH)DISTANCE FORMULA (GRADE 10 MATH)
DISTANCE FORMULA (GRADE 10 MATH)
 
Diploma_Semester-II_Advanced Mathematics_Complex number
Diploma_Semester-II_Advanced Mathematics_Complex numberDiploma_Semester-II_Advanced Mathematics_Complex number
Diploma_Semester-II_Advanced Mathematics_Complex number
 
Types of RELATIONS
Types of RELATIONSTypes of RELATIONS
Types of RELATIONS
 
Relations
RelationsRelations
Relations
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
RELATION
RELATIONRELATION
RELATION
 
Domain and range of a RELATION
Domain and range of a RELATIONDomain and range of a RELATION
Domain and range of a RELATION
 
Relation and function_xii
Relation and function_xiiRelation and function_xii
Relation and function_xii
 
Pythagorean theorem and distance formula powerpoint1
Pythagorean theorem and distance formula powerpoint1Pythagorean theorem and distance formula powerpoint1
Pythagorean theorem and distance formula powerpoint1
 
Application of graph theory in drug design
Application of graph theory in drug designApplication of graph theory in drug design
Application of graph theory in drug design
 
Mathematics 9 Radical Expressions (1)
Mathematics 9 Radical Expressions (1)Mathematics 9 Radical Expressions (1)
Mathematics 9 Radical Expressions (1)
 
May 5, 2014
May 5, 2014May 5, 2014
May 5, 2014
 

Similar to Relations

dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxRockyIslam5
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfSanjanaAdri
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relationsnszakir
 
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
 
Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1RAHUL SINGH
 
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
 
Matematika terapan week 4
Matematika terapan week 4 Matematika terapan week 4
Matematika terapan week 4 nellylawar
 
Relations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdfRelations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdfAakashKushwaha26
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics NANDINI SHARMA
 
1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptx1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptxswapnilbs2728
 
Maths chapter wise Important questions
Maths chapter wise Important questionsMaths chapter wise Important questions
Maths chapter wise Important questionsSrikanth KS
 
What is the distance between the points B and C Experience Tradition/tutorial...
What is the distance between the points B and C Experience Tradition/tutorial...What is the distance between the points B and C Experience Tradition/tutorial...
What is the distance between the points B and C Experience Tradition/tutorial...pinck3124
 
Discrete mathematics (1)
Discrete mathematics (1)Discrete mathematics (1)
Discrete mathematics (1)Krishnan Ram
 

Similar to Relations (20)

dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptx
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdf
 
Relations in Discrete Math
Relations in Discrete MathRelations in Discrete Math
Relations in Discrete Math
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: 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)
 
Lemh101
Lemh101Lemh101
Lemh101
 
Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1
 
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
 
2 homework
2 homework2 homework
2 homework
 
Matematika terapan week 4
Matematika terapan week 4 Matematika terapan week 4
Matematika terapan week 4
 
Relations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdfRelations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdf
 
Per5 relasi
Per5 relasiPer5 relasi
Per5 relasi
 
Graphs.pdf
Graphs.pdfGraphs.pdf
Graphs.pdf
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics
 
1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptx1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptx
 
Maths chapter wise Important questions
Maths chapter wise Important questionsMaths chapter wise Important questions
Maths chapter wise Important questions
 
What is the distance between the points B and C Experience Tradition/tutorial...
What is the distance between the points B and C Experience Tradition/tutorial...What is the distance between the points B and C Experience Tradition/tutorial...
What is the distance between the points B and C Experience Tradition/tutorial...
 
Discrete mathematics (1)
Discrete mathematics (1)Discrete mathematics (1)
Discrete mathematics (1)
 

More from University of Potsdam (20)

Computer fundamentals 01
Computer fundamentals 01Computer fundamentals 01
Computer fundamentals 01
 
Workshop on android apps development
Workshop on android apps developmentWorkshop on android apps development
Workshop on android apps development
 
Transparency and concurrency
Transparency and concurrencyTransparency and concurrency
Transparency and concurrency
 
Database System Architecture
Database System ArchitectureDatabase System Architecture
Database System Architecture
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
indexing and hashing
indexing and hashingindexing and hashing
indexing and hashing
 
data recovery-raid
data recovery-raiddata recovery-raid
data recovery-raid
 
Query processing
Query processingQuery processing
Query processing
 
Machine Learning for Data Mining
Machine Learning for Data MiningMachine Learning for Data Mining
Machine Learning for Data Mining
 
Tree, function and graph
Tree, function and graphTree, function and graph
Tree, function and graph
 
Sonet
SonetSonet
Sonet
 
Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
Series parallel ac rlc networks
Series parallel ac rlc networksSeries parallel ac rlc networks
Series parallel ac rlc networks
 
Series parallel ac networks
Series parallel ac networksSeries parallel ac networks
Series parallel ac networks
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Prim algorithm
Prim algorithmPrim algorithm
Prim algorithm
 
Predicate & quantifier
Predicate & quantifierPredicate & quantifier
Predicate & quantifier
 
Number system
Number systemNumber system
Number system
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
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 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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
“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
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Recently uploaded (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
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
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
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 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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
“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...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

Relations

  • 1. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 1 Relations: DEFINITION 1: Let A and B be sets. A binary relation from A to B is a subset of A × B. Example 1: Let A = {0, 1, 2} and B = {a, b}. Then {(0, a), (0, b), (1, a), (2, b)} is a relation from A to B. This means, for instance, that 0 R a, but that 1 b. Relations can be represented graphically, as shown in Figure 1, using arrows to represent ordered pairs. Another way to represent this relation is to use a table, which is also done in Figure 1. Figure 1: Displaying the Ordered Pairs in the Relation R from Example 1. Example 2: Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R = {(a, b) | a divides b}? Solution: Because (a, b) is in R if and only if a and b are positive integers not exceeding 4 such that a divides b, we see that R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}. The pairs in this relation are displayed both graphically and in tabular form in Figure 2.
  • 2. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 2 Figure 2: Displaying the Ordered Pairs in the Relation R from Example 2: Example 3: Consider these relations on the set of integers: R1 = {(a, b) | a ≤ b}, R2 = {(a, b) | a > b}, R3 = {(a, b) | a = b or a = −b}, R4 = {(a, b) | a = b}, R5 = {(a, b) | a = b + 1}, R6 = {(a, b) | a + b ≤ 3}. Which of these relations contain each of the pairs (1, 1), (1, 2), (2, 1), (1,−1), and (2, 2)? Solution: The pair (1, 1) is in R1, R3, R4, and R6; (1, 2) is in R1 and R6; (2, 1) is in R2, R5, and R6; (1,−1) is in R2, R3, and R6; and finally, (2, 2) is in R1, R3, and R4. DEFINITION 2: A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A. Example 4: Consider the following relations on {1, 2, 3, 4}: R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)}, R2 = {(1, 1), (1, 2), (2, 1)}, R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)}, R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)}, R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
  • 3. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 3 R6 = {(3, 4)}. Which of these relations are reflexive? Solution: The relations R3 and R5 are reflexive because they both contain all pairs of the form (a, a), namely, (1, 1), (2, 2), (3, 3), and (4, 4). The other relations are not reflexive because they do not contain all of these ordered pairs. In particular, R1, R2, R4, and R6 are not reflexive because (3, 3) is not in any of these relations. DEFINITION 3: A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A. A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called antisymmetric. Example 5: Which of the relations from Example 4 are symmetric and which are antisymmetric? Solution: The relations R2 and R3 are symmetric, because in each case (b, a) belongs to the relation whenever (a, b) does. For R2, the only thing to check is that both (2, 1) and (1, 2) are in the relation. For R3, it is necessary to check that both (1, 2) and (2, 1) belong to the relation, and (1, 4) and (4, 1) belong to the relation. The reader should verify that none of the other relations is symmetric. This is done by finding a pair (a, b) such that it is in the relation but (b, a) is not. R4, R5, and R6 are all antisymmetric. For each of these relations there is no pair of elements a and b with a ≠ b such that both (a, b) and (b, a) belong to the relation. The reader should verify that none of the other relations is antisymmetric. This is done by finding a pair (a, b) with a ≠ b such that (a, b) and (b, a) are both in the relation. DEFINITION 4: A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R, for all a, b, c ∈ A. Example 6: Which of the relations in Example 4 are transitive? Solution: R4, R5, and R6 are transitive. For each of these relations, we can show that it is transitive by verifying that if (a, b) and (b, c) belong to this relation, then (a, c) also does. For instance, R4 is transitive, because (3, 2) and (2, 1), (4, 2) and (2, 1), (4, 3) and (3, 1), and (4, 3) and (3, 2) are the only such sets of pairs, and (3, 1), (4, 1), and (4, 2) belong to R4. The reader should verify that R5 and R6 are transitive.
  • 4. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 4 R1 is not transitive because (3, 4) and (4, 1) belong to R1, but (3, 1) does not. R2 is not transitive because (2, 1) and (1, 2) belong to R2, but (2, 2) does not. R3 is not transitive because (4, 1) and (1, 2) belong to R3, but (4, 2) does not.
  • 5. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 5 Graphs: DEFINITION 1: A graph G = (V,E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each edge has either one or two vertices associated with it, called its endpoints. An edge is said to connect its endpoints. Simple graph: A graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices is called a simple graph. Figure 1 shows a simple graph. Figure 1: A computer network which is an example of simple graph Multigraphs: Graphs that may have multiple edges connecting the same vertices are called multigraphs. Figure 2 shows a Multigraph. Figure 2: A computer network forms a multigraph Pseudographs: Graphs that may include loops are called pseudographs. Figure 3 shows a pseudograph.
  • 6. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 6 Figure 3: A computer network forms a pseudograph DEFINITION 2: A directed graph (or digraph) (V ,E) consists of a nonempty set of vertices V and a set of directed edges (or arcs) E. Each directed edge is associated with an ordered pair of vertices. The directed edge associated with the ordered pair (u, v) is said to start at u and end at v. Figure 4 shows a simple directed graph. Figure 4: A communication network forms a simple directed graph Directed Multigraph: Directed graph that have multiple directed edges are called directed multigraph. Figure 5 shows a directed multigraph. Figure 5: A computer network forms a directed multigraph
  • 7. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 7 Graph Overview:
  • 8. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 8 Graph Terminology: DEFINITION 1: The degree of a vertex in an undirected graph is the number of edges incident with it, except that a loop at a vertex contributes twice to the degree of that vertex. The degree of the vertex v is denoted by deg(v). EXAMPLE 1: What are the degrees of the vertices in the graphs G and H displayed in Figure 1? Solution: In G, deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d ) = 1, deg(e) = 3, and deg(g) = 0. In H, deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, and deg(d ) = 5. A vertex of degree zero is called isolated. Vertex g in graph G in Example 1 is isolated. A vertex is pendant if and only if it has degree one. Vertex d in graph G in Example 1 is pendant. THEOREM 1: THE HANDSHAKING THEOREM Let G = (V ,E) be an undirected graph with m edges. Then EXAMPLE 2: How many edges are there in a graph with 10 vertices each of degree six? Solution:
  • 9. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 9 Because the sum of the degrees of the vertices is 6 × 10 = 60, it follows that 2m = 60 where m is the number of edges. Therefore, m = 30. DEFINITION 2: In a graph with directed edges the in-degree of a vertex v, denoted by deg− (v), is the number of edges with v as their terminal vertex. The out-degree of v, denoted by deg+ (v), is the number of edges with v as their initial vertex. EXAMPLE 3: Find the in-degree and out-degree of each vertex in the graph G with directed edges shown in Figure 2. Figure 2: The directed graph G Solution: The in-degrees in G are: deg− (a) = 2, deg− (b) = 2, deg− (c) = 3, deg− (d) = 2, deg− (e) = 3, and deg− (f) = 0. The out-degrees are deg+ (a) = 4, deg+ (b) = 1, deg+ (c) = 2, deg+ (d) = 2, deg+ (e) = 3, and deg+ (f ) = 0. THEOREM 2: Let G = (V ,E) be a graph with directed edges. Then Some special simple graphs: Complete Graphs: A complete graph on n vertices, denoted by Kn, is a simple graph that contains exactly one edge between each pair of distinct vertices. The graphs Kn, for n = 1, 2, 3, 4, 5, 6, are displayed in Figure 3.
  • 10. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 10 Figure 3: The Graphs Kn for 1 ≤ n ≤ 6 Cycles: A cycle Cn, n ≥ 3, consists of n vertices v1, v2, . . . , vn and edges {v1, v2}, {v2, v3}, . . . , {vn−1, vn}, and {vn, v1}. The cycles C3, C4, C5, and C6 are displayed in Figure 4. FIGURE 4: The Cycles C3, C4, C5, and C6 Wheels: We obtain a wheel Wn when we add an additional vertex to a cycle Cn, for n ≥ 3, and connect this new vertex to each of the n vertices in Cn, by new edges. The wheels W3, W4, W5, and W6 are displayed in Figure 5. FIGURE 5: The Wheels W3, W4, W5, and W6 DEFINITION 3: A simple graph G is called bipartite if its vertex set V can be partitioned into two disjoint sets V1 and V2 such that every edge in the graph connects a vertex in V1 and a vertex in V2. EXAMPLE 4:
  • 11. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 11 C6 is bipartite, as shown in Figure 6, because its vertex set can be partitioned into the two sets V1 = {v1, v3, v5} and V2 = {v2, v4, v6}, and every edge of C6 connects a vertex in V1 and a vertex in V2. FIGURE 6: Showing that C6 is bipartite EXAMPLE 5: Are the graphs G and H displayed in Figure 7 bipartite? FIGURE 7: The Undirected Graphs G and H Solution: Graph G is bipartite because its vertex set is the union of two disjoint sets, {a, b, d} and {c, e, f, g}, and each edge connects a vertex in one of these subsets to a vertex in the other subset. Graph H is not bipartite because its vertex set cannot be partitioned into two subsets so that edges do not connect two vertices from the same subset. Complete Bipartite Graphs: A complete bipartite graph Km,n is a graph that has its vertex set partitioned into two subsets of m and n vertices, respectively with an edge between two vertices if and only if one vertex is in the first subset and the other vertex is in the second subset. The complete bipartite graphs K2,3, K3,3, K3,5, and K2,6 are displayed in Figure 8.
  • 12. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 12 Figure 8: Some Complete Bipartite Graphs
  • 13. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 13 Representing Graphs: There are two methods to represent graphs: a. Adjacency list b. Adjacency matrix Example 1: Use adjacency lists to describe the simple graph given in Figure 1. Solution: Table 1 lists those vertices adjacent to each of the vertices of the graph. Example 2: Use adjacency lists to describe the directed graph given in Figure 2. Solution: Table 2 represents the directed graph shown in Figure 2. Example 3: Use an adjacency matrix to represent the graph shown in Figure 3.
  • 14. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 14 Figure 3: Simple Graph Solution: We order the vertices as a, b, c, d. The matrix representing this graph is Example 4: Draw a graph with the adjacency matrix with respect to the ordering of vertices a, b, c, d. Solution: A graph with this adjacency matrix is shown in Figure 4. Figure 4: Adjacency matrix of example 4 Example 5:
  • 15. Gazi Zahirul Islam, Assistant Professor, Department of CSE, Daffodil International University, Dhaka 15 Use an adjacency matrix to represent the pseudograph shown in Figure 5. Figure 5: A pseudograph Solution: The adjacency matrix using the ordering of vertices a, b, c, d is