0% found this document useful (0 votes)
90 views29 pages

Discrete Structures For Computer Science: Lecture - 13 DR DPRV Subba Rao

This document discusses relations and their properties in discrete mathematics. It defines relations as subsets of the Cartesian product of two sets and provides examples. It then covers properties of relations such as reflexive, symmetric, transitive, and their definitions and examples. Applications of equivalence relations in automata theory and representations of relations as directed graphs and Boolean matrices are also mentioned.

Uploaded by

Pandu Doradla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views29 pages

Discrete Structures For Computer Science: Lecture - 13 DR DPRV Subba Rao

This document discusses relations and their properties in discrete mathematics. It defines relations as subsets of the Cartesian product of two sets and provides examples. It then covers properties of relations such as reflexive, symmetric, transitive, and their definitions and examples. Applications of equivalence relations in automata theory and representations of relations as directed graphs and Boolean matrices are also mentioned.

Uploaded by

Pandu Doradla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Discrete Structures for Computer

Science

Lecture – 13
Dr DPRV Subba Rao
Overview

• Relations

• Properties of Relations

• Application of Equivalence relations in the theory of automata

• Representations of Relations as Mathematical Modals :Directed Graphs, Boolean Matrices


Definition

Let A and B be any two non empty sets. We define the product set or the cartesian product
of the sets A and B as the set of all ordered pairs (a,b) with a  A and b  B .
i.e., AxB = {(a,b)/ a A, b B}. Any subset R of the cartesian product AxB is called a relation
from A to B and the members of R are denoted as either aRb or (a,b) R

Example: Consider, A = { New Delhi, Tokyo, Washington, Moscow,Beijing} and B = { Russia, USA, China, Japan,
India}
Here we can observe a relation from A to B as
R = {(New Delhi,India),(Tokyo,Japan),(Washington,USA),(Moscow,Russia),(Beijing,China)}

Definition: If R is a relation from a set A to A then we say R is a relation on A.


Counting

Now we want know how many relations can be obtained from a set A to a set B.

If A has n elements and B has m elements then A X B has mn elements.

Example: Let A = {1,2} and B = {a, b, c} then A x B = {(1,a), (1,b), ( 1,c), (2,a), (2,b), ( 2,c)}.
A x B has 6 elements.
Properties of relations on a set A

Some properties of relations on a set A which play very important role in the theory of computer
science:

Properties of relations on a set A:

1. Reflexive

2. Symmetric

3. Transitive

4. Asymmetric

5. Anti symmetric
Reflexive

A relation R on a set A is said to be reflexive If (a,a) R (or aRa), for all a R

Ex: A = {1,2,3} and R = {(1,1),(2,2),(3,3),(1,3),(3,1)}

Ex: A = {1,2,3} and = {(1,1),(2,2),(3,3),(1,2),(2,3)}

EX: A = {1,2,3} and R = {(1,1),(2,2),(1,3),(3,1)} is not reflexive


(since the element (3,3) is not in R)
Practice problems

•1.  Let A be the set of integers. Define a relation on A as R if and only if is


even.

2. Let A be the set of real numbers Define a relation on A as aRb if and only if
+ = 4.

3. Let A be the set of positive integers. Define a relation on A as aRb if and


only if GCD () = 1
•   we have a question that If A has elements then how many reflexive relations exist on
Now
A.

To compute number of reflexive relations on a set A, we first recall a theorem from set
theory that if A contains elements then P(A) contains 2 elements.

Now we shall begin with an example and later we generalize to sets having elements. Let A
= {a,b,c} then AxA = {(a, a),(b, b),(c, c),(a,b),(a,c),(b,a),(b,c); (c,a); (c,b)}. i.e., If A has 3
elements then AxA has 9 elements.

contd..
 Now If R is a reflexive relation on A then R must contain the elements (a,a), (b,b), (c,c).

Apart from these elements we have 6 elements in AXA, with these 6 elements we can obtain
subsets of AXA in such a way that each subset has all these three (a,a), (b,b), (c,c). i.e., the
number of reflexive relations is .

Here 6 = 93 = , if A has elements. Therefore, in general, if a set A has elements then the
number of reflexive relations on A is .
Symmetric:
 A relation R on a set A is said to be symmetric If (a,b) R then (b, a) R, for a, b A

Ex: Let A = { 1,2,3} and R = {(1,3),(3,1),(2.3),(3,2)}

Ex: Let A = { 1,2,3} and R = {(1,1),(1,3),(3,1)}

Ex: Let A = {1,2,3} and R = {(1,3),(2,3)} is not symmetric


Counting

 Now let us have a question, If A has elements then how many symmetric relations
exist on A?

At first, Let us consider ordered pairs (a, b) in such a way that a b.


We have such elements in AXA.

Consider the elements (a, b), (b, a) in AXA as one.

Now we have () such pairs in AxA. Therefore we have () = = symmetric relations on


A.
Practice problems:

 1. Let A be the set of positive integers Define a relation on A as aRb if and only if |a –b| 2.

2. Let A be the set of positive integers Define a relation on A as aRb if and only if |a-b| = 2.

3. Let A be the set of all lines in the plane . Define a relation on A as R if and only if is
parallel to .

4. Let A be the set of all triangles in the plane . Define a relation on A as R if and only if the
three angles of have the same measures as the three angles of .
Algorithm for coloring a graph

 A relation R on a set A is said to be transitive If () R and () R then () R, for A.

Ex: Let A = {1,2,3} and R = {(1,1),(2,2),(1,3), (3,1), (2.3),(3,2)}

Ex: Let A = {1,2,3,4} and R = {(1,2),(1,3),(4,2)}

Ex: Let A = {1,2,3} and R = {(2,2),(1,3),(3,1),(2.3),(3,2)} is not a transitive relation


Algorithm for coloring a graph
Welsh Powell Algorithm:
Example
Algorithm for coloring a graph
Welsh Powell Algorithm:
Example
Algorithm for coloring a graph
Welsh Powell Algorithm:
Example
Algorithm for coloring a graph
Welsh Powell Algorithm:
Example
Chromatic Polynomials

 
Definition: Polynomial which gives the number of ways of proper coloring a graph
using a given number of colors.
The value of the Chromatic polynomial of a graph G with n vertices gives the no. of ways of
properly coloring the graph using λ or fewer colors.It is denoted by (λ) or (λ)

Example: Let G = chain of length n-1 (so there are n vertices)


(λ) =
Chromatic Polynomials

 Finding the polynomial:

Let be the different ways of properly colouring G using exactly different colours. Since
colours can be chosen out of λ colours in different ways, there are different ways of
properly colouring G using exactly colours out of λ colours.

Since i can be any positive integer from 1 to n (it is not possible to use more than n colours
on n vertices), the chromatic polynomial is a sum of these terms,
that is, (λ) =
Chromatic Polynomials
Example of Finding the Chronmatic polynomial: Find the chromatic polynomial of the graph given in Figure
 Solution.
(λ) =
Since the graph in Figure has a triangle, it will require at least three
different colours for proper colourings.
Therefore, = = 0 and = 5 !
Moreover, to evaluate , suppose that we have three colours x, y and .
These three colours can be assigned properly to vertices , and in 3 ! = 6
different ways.
Having done that, we have no more choices left, because vertex must
have the same colour as and must have the same colour as .
Therefore, = 6.
Similarly, with four colours, , and can be properly coloured in 4 • 6 = 24
different ways.
Chromatic Polynomials

 Thefourth colour can be assigned to or , thus providing two choices.


The fifth vertex provides no additional choice.
Therefore, = 24 • 2 = 48.
Substituting these coefficients in (λ) , we get Chronmatic polynomial, for the graph in Figure

(λ) = + +
= -5
Applications of Graph Coloring

The graph coloring problem has huge number of applications.

• Making Schedule or Time Table:

• Mobile Radio Frequency Assignment:

• Sudoku:

• Register Allocation:

• Bipartite Graphs:

• Map Coloring:
Applications of Graph Coloring

Applications: Sudoku

• Each cell is a vertex

• Each integer label is a “color”

• A vertex is adjacent to another vertex if one of the following hold:

• Same row
• Same column
• Same 3x3 grid

• Vertex-coloring solves Sudoku


Applications of Graph Coloring

Color a map such that two regions with a common border are assigned different colors.

Each map can be represented by a graph:


– Each region of the map is represented by a vertex;
– Edges connect two vertices if the regions represented by these vertices have a common border.

• The resulting graph is called the dual graph of the map.


Applications of Graph Coloring

The Groupe Spécial Mobile (GSM) was created in 1982 to provide a standard for a mobile telephone system. The
first GSM network was launched in 1991 by Radiolinja in Finland with joint technical infrastructure maintenance
from Ericsson. Today, GSM is the most popular standard for mobile phones in the world, used by over 2 billion
people across more than 212 countries. GSM is a cellular network with its entire geographical range divided into
hexagonal cells. Each cell has a communication tower which connects with mobile phones within the cell. All
mobile phones connect to the GSM network by searching for cells in the immediate vicinity. GSM networks
operate in only four different frequency ranges. The reason why only four different frequencies suffice is clear:
the map of the cellular regions can be properly colored by using only four different colors! So, the vertex coloring
algorithm may be used for assigning at most four different frequencies for any GSM mobile phone network
Applications of Graph Coloring

Register Allocation: In compiler optimization, register allocation is the process of assigning


a large number of target program variables onto a small number of CPU registers. This
problem is also a graph coloring problem
• Register pressure
– How determine what should be stored in registers
– Determine what to “spill” to memory

• Typical RA utilize graph coloring for underlying allocation problem


– Build graph to manage conflicts between live ranges
Applications of Graph Coloring

Channel Assignment

• Find a channel assignment to radio stations such that no station has a conflict
(there is a conflict if they are in vicinity)

• Vertices – radio stations, edges – conflict, colors – available channels


Applications of Graph Coloring

Problem: A state legislature has a number of committees that meet each week for one hour.
How can we schedule the committee meetings times such that the least amount of time is
used but such that two committees with overlapping membership do not meet at the same
time.
Solution:

• A vertex represents a meeting


• An edge represents a conflict between to meetings
• The chromatic number of this graph is four. Thus four hours suffice to schedule committee meetings without conflict.
Thank you

You might also like