Discrete Structures For Computer Science: Lecture - 13 DR DPRV Subba Rao
Discrete Structures For Computer Science: Lecture - 13 DR DPRV Subba Rao
Science
Lecture – 13
Dr DPRV Subba Rao
Overview
• Relations
• Properties of Relations
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)}
Now we want know how many relations can be obtained from a set A to a set B.
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:
1. Reflexive
2. Symmetric
3. Transitive
4. Asymmetric
5. Anti symmetric
Reflexive
2. Let A be the set of real numbers Define a relation on A as aRb if and only if
+ = 4.
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
Now let us have a question, If A has elements then how many symmetric relations
exist on A?
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
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 (λ)
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
(λ) = + +
= -5
Applications of Graph Coloring
• Sudoku:
• Register Allocation:
• Bipartite Graphs:
• Map Coloring:
Applications of Graph Coloring
Applications: Sudoku
• Same row
• Same column
• Same 3x3 grid
Color a map such that two regions with a common border are assigned different colors.
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
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)
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: