You are on page 1of 25

BITS Pilani

Pilani Campus

MATH F213
Relations and Digraphs
Learning Objectives

• To understand an important structure of a relation on a set.


• The representation of a relation on a set with directed graphs.
• To study important classes of relation like equivalence relations and
ordering relations defined by their important properties.

BITS Pilani, Pilani Campus


What is a relation?

We recall definition and certain properties of a relation form section 1.3 of the
text.
Definition : For sets 𝐴, 𝐵, a (binary) relation 𝑅 from 𝐴 to 𝐵 is a subset of 𝐴 × 𝐵.
(Thus its elements are some ordered pairs 𝑎, 𝑏 , 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵.)
If 𝐵 = 𝐴, then we say 𝑅 is a binary relation on 𝐴.
An 𝑛-ary relation 𝑅 on 𝐴 is a subset of 𝐴𝑛 . If 𝑛 = 1, then 𝑅 is called a unary
relation on 𝐴.
Ex. Let 𝐴 = the set of all real numbers. Then
𝑅 = { 𝑥, 𝑦 : 𝑥, 𝑦 are real numbers with 𝑥 2 + 𝑦 2 < 1}
Is a binary relation on 𝐴.

BITS Pilani, Pilani Campus


Definition : For a relation 𝑅 from 𝐴 to 𝐵, the domain of 𝑅 is
the set dom 𝑅 = {𝑥 ∈ 𝐴 ∶ (𝑥, 𝑦) ∈ 𝑅 for some 𝑦 ∈ 𝐵}.
The range of 𝑅 is the set
ran 𝑅 = {𝑦 ∈ 𝐵: ∶ (𝑥, 𝑦) ∈ 𝑅 for some 𝑥 ∈ 𝐴}.
Definition : Let 𝑅 be a relation from 𝐴 to 𝐵.
• For any 𝑎 ∈ 𝐴, We define
𝑅 𝑎 = 𝑏 ∈ 𝐵: 𝑎, 𝑏 ∈ 𝑅 .
• The relation 𝑅−1 from 𝐵 to 𝐴 is defined by
𝑅−1 = { 𝑏, 𝑎 : (𝑎, 𝑏) ∈ 𝑅}.
Note : As a consequence, for any b ∈ 𝐵,
𝑅−1 𝑏 = 𝑎 ∈ 𝐴 ∶ 𝑎, 𝑏 ∈ 𝑅 .

BITS Pilani, Pilani Campus


Another notation : If 𝑎, 𝑏 ∈ 𝑅, we write 𝑎𝑅𝑏.
Ex : For the relation on the set A of real numbers,
𝑅 = { 𝑥, 𝑦 : 𝑥, 𝑦 are real numbers with 𝑥 2 + 𝑦 2 < 1}
dom 𝑅 = 𝑥 ∈ 𝐴 ∶ −1 < 𝑥 < 1 = Ran 𝑅.
𝑅−1 = R.
1 3 3
𝑅 = 𝑥∈𝐴∶− <𝑥< .
2 2 2
𝑅 0 = −1,1
𝑅 1 = ∅.

BITS Pilani, Pilani Campus


Functions
Definition : A relation 𝑅 from 𝐴 to 𝐵 is called a function (or a
map) from A to B if
(i) dom 𝑅 = 𝐴, and (ii) If 𝑥, 𝑦 , (𝑥, 𝑧) ∈ 𝑅 then 𝑦 = 𝑧.
Equivalently A relation 𝑅 from 𝐴 to 𝐵 is a function from A to
B iff for every 𝑥 ∈ 𝐴 there exists a unique 𝑦 ∈ 𝐵 such that
𝑥𝑅𝑦.
This happens if and only if 𝑅 𝑎 = 1 for all 𝑎 ∈ 𝐴.
The function 𝑅 is called one-to-one (or injective) if
𝑥, 𝑧 , 𝑦, 𝑧 ∈ 𝑅 𝑖𝑚𝑝𝑙𝑖𝑒𝑠 𝑥 = 𝑦. Thus 𝑅 is one-to-one if
and only if for all 𝑏 ∈ Ran 𝑅, |𝑅−1 𝑏 | = 1.
𝑅 is called onto if ran 𝑅 = 𝐵. 𝑅 is called a one-to-one
correspondence from A to B if 𝑅 is one-to-one as well as
onto.
BITS Pilani, Pilani Campus
Note : If 𝑅 is a one-to-one correspondence from 𝐴 to 𝐵 then
𝑅−1 is a one-to-one correspondence form 𝐵 to 𝐴, in
particular, 𝑅−1 is a function from 𝐵 to 𝐴.
Definition : If 𝑅 is a relation from 𝐴 to 𝐵 and 𝑆 is a relation
from 𝐵 to 𝐶, then the composition of R and S is defined
by a relation 𝑅 ∙ 𝑆 (𝑜𝑟 𝑅𝑆) from 𝐴 to 𝐶 such that
𝑓𝑜𝑟 𝑥 ∈ 𝐴, 𝑦 ∈ 𝐶, 𝑥, 𝑦 ∈ 𝑅𝑆 if and only if there exists 𝑧 ∈ 𝐵
such that 𝑥, 𝑧 ∈ 𝑅, 𝑧, 𝑦 ∈ 𝑆.
Ex. : Let 𝐴 = 1,2,3 , 𝐵 = 4,5 , 𝐶 = 𝑎, 𝑏, 𝑐 , 𝑅 =
1,4 , 1,5 , 2,5 , 𝑆 = 4, 𝑎 , 5, 𝑐 . Then
𝑅𝑆 = 1, 𝑎 , 1, 𝑐 , 2, 𝑐 .

BITS Pilani, Pilani Campus


Notes :
• If 𝑅 is a one-to-one correspondence from 𝐴 to 𝐵 then
𝑅𝑅−1 = 𝑎, 𝑎 : 𝑎 ∈ 𝐴 , 𝑅−1 𝑅 = 𝑏, 𝑏 : 𝑏 ∈ 𝐵 , the diagonals of 𝐴 and 𝐵
respectively.
• If 𝐴 = 1,2 , 𝐵 = {𝑎, 𝑏} then 𝑅 = 𝐴 × 𝐵 is a relation from 𝐴 to 𝐵 but 𝑅𝑅−1 = 𝐴 ×
𝐴.

BITS Pilani, Pilani Campus


Relations and digraphs

We define a new concept called a directed graph (or digraph) and show its
connection with a binary relation on a finite set V.
We will show that these two concepts are different ways of viewing the same
object, each having its own advantages.

BITS Pilani, Pilani Campus


Digraphs
Definition : A pair of sets 𝐺 = (𝑉, 𝐸) is called a directed
graph ( or digraph) if 𝐸 ⊆ 𝑉 × 𝑉. 𝑉 is a finite set whose
elements are called the vertices of 𝐺 and elements of 𝐸
are called the edges of 𝐺.
Thus if 𝐺 = (𝑉, 𝐸) is a digraph then 𝐸 is a relation on 𝑉. On
the other hand if R is a relation on A then 𝐺 = (𝐴, 𝑅) is a
digraph.
An edge e = (𝑥, 𝑦) of G is said to be incident from 𝑥 and
incident to 𝑦. We also say 𝑒 is incident on both 𝑥 and 𝑦.
If (𝑥, 𝑦) ∈ 𝐸 then we say 𝑥 is adjacent to 𝑦.
An edge of 𝐺 from a vertex to itself is called a loop (or a
self-loop) of 𝐺.
A digraph G is called simple if it has no loops.

BITS Pilani, Pilani Campus


Relations from 𝐴 to 𝐵

A binary relation 𝑅 from 𝐴 to 𝐵 is a subset of 𝐴 × 𝐵. This can be viewed as a


subset of 𝐴 ∪ 𝐵 × 𝐴 ∪ 𝐵 , and hence a relation on 𝐴 ∪ 𝐵 . Thus it
corresponds to the digraph 𝐺 = 𝐴 ∪ 𝐵 , 𝑅 .

BITS Pilani, Pilani Campus


Geometric representation of digraphs

A digraph can be drawn geometrically thus :


Any vertex is represented by a point. An edge from 𝑥 to 𝑦 is represented by an
arrow from the point representing 𝑥 to the point representing 𝑦.
Ex : Let 𝐺 = (𝑉, 𝐸) be a digraph with

V = {a,c,m,w}
E= { (a,a),(m,m) (w,w), (c,a), (c,w),(c,m),
(a,m), (m,w) }

BITS Pilani, Pilani Campus


Geometric representation of G

(a,a)

G: a
(c,a) (a,m) (m,m)
(c,m)
c m
(c,w)
(m,w)
w

(w,w)

MATH ZC222 Discrete Structures for


Computer Science 13
22-8-2013
BITS Pilani, Pilani Campus
P 335 #1 (b)

Draw the digraph for the relation ⊂ on all the nonempty


subsets of {0, 1, 2}.

BITS Pilani, Pilani Campus


P 335 #1 (b)

Draw the digraph for the relation ⊂ on all the nonempty


subsets of {0, 1, 2}.
Solution : 𝑉 = {𝑣1 , … , 𝑣7 } where
𝑣1 = 0 , 𝑣2 = 1 , 𝑣3 = 2 , 𝑣4 = 0,1 , 𝑣5 = 0,2 ,
𝑣6 = 1,2 , 𝑣7 = 0, 1, 2 .
The digraph is drawn below.

BITS Pilani, Pilani Campus


in-degree and out-degree

For a digraph 𝐺 = (𝑉, 𝐸), in-degree of a vertex 𝑣 ∈ 𝑉 is the number of vertices


𝑤 ∈ 𝑉 adjacent to 𝑣.
in-deg(𝑣) = 𝑤 ∈ 𝑉 ∶ 𝑤, 𝑣 ∈ 𝐸 .
The out-degree of a vertex 𝑣 ∈ 𝑉 is the number of edges incident from 𝑣.
out-deg(𝑣) = 𝑤 ∈ 𝑉 ∶ 𝑣, 𝑤 ∈ 𝐸 .
If 𝑅 = 𝐸 is thought as a relation on 𝑉, then
in-deg(𝑣)) = |𝑅−1 𝑣 |, out-deg(𝑣) = |R 𝑣 |.
For the previous example 𝐺,
in-deg(m)=3, out-deg(m)=2.

BITS Pilani, Pilani Campus


Directed multigraph, graph
If more than one edge is allowed to be incident from a vertex 𝑣 to
a vertex 𝑤, we get a directed multigraph.
Directed graph is a special case of a directed multigraph.
If more than one edge occurs from a vertex 𝑣 to a vertex 𝑤, we
say it is a multiple edge.
If we disregard the direction of edges in a digraph(directed
multigraph), we get a nondirected graph(a nondirected
multigraph).
Precise formulation of directed multigraph: In stead of considering
𝐸 as a subset of 𝑉 × 𝑉, we consider a directed multigraph as a
map 𝜑: 𝐸 → 𝑉 × 𝑉. A multiple edge occurs from a vertex 𝑣 to a
vertex 𝑤 if more than one element of E is mapped to 𝑣, 𝑤 . If 𝜑
is the inclusion map, then we get the directed graph definition.
BITS Pilani, Pilani Campus
Remark on terminology

A term graph can be applied to any of directed or nondirected graph or


multigraph. Results or concepts that hold for all these cases will be stated for
graphs.
Caution : Many a times same terminology used in different contexts have a
different meaning. One must carefully check its meaning before following it
and specify the kind of graph for which it holds.

BITS Pilani, Pilani Campus


Subgraphs

Definition : A graph 𝐺 1 = 𝑉 1 , 𝐸1 is called a subgraph of a


graph 𝐺 = 𝑉, 𝐸 if 𝑉 1 ⊆ 𝑉 and 𝐸1 ⊆ 𝐸 ∩ 𝑉 1 × 𝑉 1 .
Moreover 𝐺 1 is a proper subgraph of 𝐺 if 𝐺 1 ≠ 𝐺.
Ex. : The digraph on left is a subgraph of the one on right.
(a,a)
a (a,a)
(a,m) (m,m) a
(c,a) (a,m) (m,m)
m (c,m)
c m
(m,w) (c,w)
(m,w)
w
w
(w,w)
(w,w)
BITS Pilani, Pilani Campus
Graph isomorphism

Sometimes we are not interested in naming of vertices. If graphs can be


identified after renaming of vertices, then we call them isomorphic. More
formally, we have :
Definition : Two graphs 𝐺1 = 𝑉1 , 𝐸1 and 𝐺2 = 𝑉2 , 𝐸2 are called isomorphic if
there is a one-to-one and onto map 𝑓: 𝑉1 → 𝑉2 which preserves adjacency of
vertices; for digraphs this means 𝑣, 𝑤 ∈ 𝐸1 if and only if 𝑓(𝑣), 𝑓(𝑤) ∈ 𝐸2 .
If the above condition holds then 𝑓 is called an (directed graph) isomorphism
from 𝐺1 to 𝐺2 .

BITS Pilani, Pilani Campus


Invariants of graphs

A function 𝑔 on graphs is called invariant of graphs (under isomorphism) if


graphs 𝐺1 , 𝐺2 are isomorphic implies 𝑔(𝐺1 ) = 𝑔(𝐺2 ).
Examples :
1) 𝑉 is a graph invariant as if graphs 𝐺1 , 𝐺2 are isomorphic then 𝑉1 = 𝑉2 ,as
the isomorphism 𝑔 is one-to-one and onto function from 𝑉1 to 𝑉2 . It is called
the order of 𝐺.
2) 𝐸 is a graph invariant as if 𝑔 is an isomorphism from 𝐺1 to 𝐺2 then
𝑣, 𝑤 ⟼ 𝑔 𝑣 , 𝑔(𝑤) gives a one-to-one and onto map from 𝐸1 to 𝐸2 . It is
called the size of G.

BITS Pilani, Pilani Campus


Degree spectrum.

For a digraph 𝐺, the degree spectrum of 𝐺 is the collection of all pairs 𝑖, 𝑗 ,


where 𝑖 = 𝑖𝑛-deg 𝑣 , 𝑗 = 𝑜𝑢𝑡𝑑𝑒𝑔(𝑣), as 𝑣 varies over the vertices of 𝐺.
Ex : Let 𝐺 = (𝑉, 𝐸) be a digraph with

V = {a,c,m,w}
E= { (a,a),(m,m) (w,w), (c,a), (c,w),(c,m),
(a,m), (m,w) }.

The degree spectrum of G is


{(2, 2), (0,3),(3, 2), (3,1)}.
It can also be seen from the geometric
representation of G on the right.

BITS Pilani, Pilani Campus


Another invariant

Theorem : The degree spectrum is an invariant of the digraph.


Proof : Let 𝑔: 𝐺1 → 𝐺2 be an isomorphism of digraphs. For any vertex 𝑣 of 𝐺1 , if
{𝑣1 , … , 𝑣𝑘 } is the set of all vertices of 𝐺1 adjacent from 𝑣, then
{𝑔(𝑣1 ), … , 𝑔(𝑣𝑘 )} is the set of all vertices of 𝐺2 adjacent from g(𝑣). Thus
𝑜𝑢𝑡𝑑𝑒𝑔(𝑣)=𝑜𝑢𝑡𝑑𝑒𝑔(g(𝑣)).
Similarly 𝑖𝑛-deg 𝑣 = 𝑖𝑛-deg 𝑔 𝑣 .
Since the pair for every vertex is same as pair for the corresponding vertices,
the result follows.

BITS Pilani, Pilani Campus


p. 333 #3(b)

For the digraphs in (a) and (b) in the following figure, give a specific
isomorphism from (a) to (b) as a set of ordered pairs [vertex in (a), vertex in
(b)].

BITS Pilani, Pilani Campus


Solution

Since corresponding vertices in the isomorphism in both


digraph must have same indegree and outdegree, the
vertex 𝑐 in digraph (a) must be mapped to the vertex 𝑎 in
digraph (b). Therefore [𝑐, 𝑎].
Where can the vertex 𝑎 in digraph (a) be mapped? Since
all other vertices in both digraphs have same indegrees
and outdegrees, we are unable to decide based on this.
Let us try [𝑎, 𝑏] and see if it works.
As in (a), 𝑏 is adjacent from 𝑎, same must happen to the
corresponding vertices in (b). But only vertex adjacent
from 𝑏 in digraph (b) is 𝑐. Hence it forces 𝑏, 𝑐 .
Continuing in similar manner, we are forced 𝑒, 𝑑 , 𝑑, 𝑒 .

BITS Pilani, Pilani Campus

You might also like