Download as pdf or txt
Download as pdf or txt
You are on page 1of 45

MHZ5355 / MHZ5375

Discrete Mathematics

C. P. S. Pathirana.
Senior Lecturer
Department of Mathematics & Philosophy of
Engineering.
The Open University of Sri Lanka.
The Open Univrsity of Sri Lanka 1
Unit 3 - Session 2
Degree and Parity of a vertex and Connectedness

• Introduction

This session contains two main parts.

I. Degree and parity of vertices.


II. Paths and connectedness.

❖ For this session, a “graph” means an “undirected graph”.


The Open Univrsity of Sri Lanka 2
9.1 Degree and parity of a vertex

• Degree of a vertex = Number of edges connecting it.

Definition 9.1

𝐺 be a graph (or a multi-graph) and 𝑣 ∈ 𝑉(𝐺) then, the


degree of 𝑣 is the number of edges incident with 𝑣,
except that a loop at a vertex contributes twice to the
degree of that vertex.
The degree of the vertex 𝑣 is denoted by 𝐝𝐞𝐠 𝒗 .

The Open Univrsity of Sri Lanka 3


➢ According to the definition degree of a vertex is the
number of edges connected to that vertex.

➢ A loop is considered as two edges.

➢ If deg(𝑣) is odd ⇒ 𝑣 is an odd vertex.

If deg(𝑣) is even ⇒ 𝑣 is an even vertex.

The Open Univrsity of Sri Lanka 4


Example

𝑣4

𝑣1 𝑣2 𝑣3

deg 𝑣1 = 1 Odd vertices


deg 𝑣2 = 3

deg 𝑣3 = 2 Even vertices


deg 𝑣4 = 4

The Open Univrsity of Sri Lanka 5


Now, we discuss the connection between the number of
vertices, their degrees and the number of edges.

Theorem 2.1 (Handshaking lemma)

Let 𝐺 be a graph (or a multi-graph) with 𝑛 vertices


(say 𝑉 𝐺 = {𝑉1 , ⋯ , 𝑣𝑛 }) and 𝑚 edges. Then,
𝑛

෍ deg(𝑣𝐼 ) = 2𝑚
𝑖=0

The Open Univrsity of Sri Lanka 6


Example
Show that the following graph satisfies handshaking lemma.

𝑣2 𝑣4

𝑣1 𝑣5
𝑣3

Number of edges 𝑚 = 6.
𝑛

෍ deg(𝑣𝐼 ) = deg v1 + deg v2 + deg v3 + deg v4 + deg(v5 )


𝑖=0
=2+2+4+2+2
= 12 The Open Univrsity of Sri Lanka 7
= 2𝑚.
Example

Can a graph have 5 vertices of degrees 1,2,3,4 and 5 ?

NO !
𝑛

෍ deg(𝑣𝐼 ) = 1 + 2 + 3 + 4 + 5
𝑖=0
= 15

15
So the graph should have edges, which is impossible.
2

➢ This is well described in the next theorem.


The Open Univrsity of Sri Lanka 8
Theorem 2.2

In every graph (or multi-graph), the number of vertices


with odd degree is even.

Proof
Let 𝐺 be a graph (or multi-graph) with 𝑛 vertices.

𝑉 𝐺 = {𝑣1 , ⋯ , 𝑣𝑛 }

Then take,
• 𝐴 – set of all even vertices.
• 𝐵 – set of all odd vertices.
The Open Univrsity of Sri Lanka 9
Then obviously,

𝐴, 𝐵 ⊆ 𝑉(𝐺) and 𝐴⋃𝐵 = 𝑉(𝐺)

Observe that,

σ𝑛𝑖=1 deg 𝑣𝑖 = σ𝑣∈A deg(𝑣) + σ𝑢∈𝐵 deg(𝑢)

= 2|𝐸 𝐺 | (by theorem 9.1)

|𝐸 𝐺 | is the number of edges in 𝐺.

Since both σ𝑛𝑖=1 deg 𝑣𝑖 and σ𝑣∈A deg(𝑣) are even,


σ𝑢∈𝐵 deg(𝑢) also should be even.

This ends the proof. The Open Univrsity of Sri Lanka 10


9.2 Special types of graphs

9.2.1 Complete graphs

Definition 2.2

A complete graph on 𝑛 vertices, is a simple graph that


contains exactly one edge between each pair of
distinct vertices and it is denoted by 𝐾𝑛 .

The Open Univrsity of Sri Lanka 11


Example

First five complete graphs are as follows.

𝐾1 𝐾2
𝐾3

𝐾4 𝐾5
The Open Univrsity of Sri Lanka 12
Theorem 2.3

𝑛 𝑛−1
For each 𝑛 ∈ ℕ, 𝐾𝑛 contains edges.
2

Proof

• Consider the graph 𝐾𝑛 for any 𝑛 ∈ ℕ.

• 𝐾𝑛 has 𝑛 vertices and so that each vertex is incident with


𝑛 − 1 edges.

• Therefore the degree sum is 𝑛 𝑛 − 1 .


The Open Univrsity of Sri Lanka 13
By theorem 2.1, the connection between degree sum and
the number of edges (m) is,

σ𝑛𝑖=0 deg(𝑣𝐼 ) = 2𝑚

𝑛 𝑛 − 1 = 2𝑚

𝑛 𝑛−1
𝑚=
2

𝑛 𝑛−1
So, 𝐾𝑛 contains number of edges.
2

The Open Univrsity of Sri Lanka 14


Example

How many edges does 𝐾5 have ?

5 5−1
Number of edges =
2

5×4
=
2

= 10.

The Open Univrsity of Sri Lanka 15


9.2.2 Bipartite Graphs

Definition 2.3

A graph 𝐺 = (𝑉, 𝐸) is said to be a bipartite graph if 𝑉


can be partitioned in to two distinct sets 𝑉1 and 𝑉2 ,
such that every edge in 𝐸 connects a vertex in 𝑉1 and a
vertex in 𝑉2 so that no edge in 𝐸 connects either two
vertices in 𝑉1 or two vertices in 𝑉2 .

The Open Univrsity of Sri Lanka 16


Example

Consider the following graph.

𝑣3
𝑣1
𝑣4
𝑣2
𝑣5
Take two distinct sets 𝑉1 and 𝑉2 as, 𝑉1 = {𝑣1 , 𝑣2 } and
𝑉2 = {𝑉3 , 𝑉4 , 𝑉5 }.
Every edge in the graph connects the two set and no edge
connects with vertices in the same set.
This is a bipartite graph. The Open Univrsity of Sri Lanka 17
Definition 2.4

Let 𝐺 = (𝑉, 𝐸) be a bipartite graph with 𝑉1 and 𝑉2 are


bipartition sets of 𝐺. Then 𝐺 is said to be a complete
bipartite graph if every vertex in 𝑉1 is joined to every
vertex in 𝑉2 .

➢ The complete bipartite graph on bipartition sets of 𝑚


and 𝑛 vertices respectively, is denoted by,

𝐾𝑚,𝑛

The Open Univrsity of Sri Lanka 18


Example

𝐾2,2 𝐾2,3
𝐾1,2

Theorem 2.4
For each 𝑚, 𝑛 ∈ ℕ, 𝐾𝑚,𝑛 contains 𝑚𝑛 edges

The Open Univrsity of Sri Lanka 19


9.2.3 Null Graphs
Definition 2.5

Let 𝐺 = (𝑉, 𝐸) be a graph. Then 𝐺 is said to be a null


graph if the edge set 𝐸 is empty.
That is 𝐸 = 𝜙.

Example

𝑢3
𝑢1
𝑢2

This is a null graph with 3 vertices.


The Open Univrsity of Sri Lanka 20
9.2.4 The complement (Inverse)

Definition 2.6

Let 𝐺(𝑉, 𝐸) be a graph. Then the complement (inverse)


of 𝐺 is a graph 𝐺 𝐶 = (𝑉, 𝐹) such that 𝐹 = 𝐾/𝐸 where 𝐾
is the set of all edges in the complete graph whose
vertex set is 𝑉.

➢ That is the complement graph contains the edges which


are absence in 𝐺.

The Open Univrsity of Sri Lanka 21


𝑢1 𝑢2 𝑢1 𝑢2

𝑢3 𝑢4 𝑢3 𝑢4

𝐺 𝐺𝑐

𝑢3 𝑢2
𝑢2
𝑢1
𝑢1 ⟹ 𝑢3
𝑢5 𝑢4
𝑢5 𝑢4
𝐺 The Open Univrsity of Sri Lanka
𝐺𝑐
22
9.2.5 Sub Graphs

Definition 2.7

Let 𝐺(𝑉, 𝐸) be a graph. Then 𝐺 ′ = 𝑉 ′ , 𝐸 ′ , is a sub


graph of 𝐺 if 𝑉′ ⊆ 𝑉 and 𝐸 ′ ⊆ 𝐸.

The Open Univrsity of Sri Lanka 23


Example 𝑣2 𝑣4

𝑣1 𝑣5
𝑣3
𝐺

𝑣4 𝑣2 𝑣4
𝑣2

𝑣1 𝑣1 𝑣5
𝑣3 𝑣3
𝐺1 𝐺2

𝐺1 and 𝐺2 are two subgraphs ofof𝐺.


The Open Univrsity Sri Lanka 24
9.3 Paths and Connectedness
9.3.1 Trial, Walk, and Path

Definition 2.8

A trial is defined as a finite alternating sequence of


vertices and edges, which is beginning and ending
with a vertex, so that each edge is incident with the
vertices preceding and following it, and any edge
cannot be appeared more than once in a trial. But
vertices can be repeated in a trial.

Starting and ending vertices are called the terminal


vertices. The Open Univrsity of Sri Lanka 25
Example
𝑒1
𝑣1 𝑣2
𝑒2

𝑒5 𝑒7 𝑒3
𝑒6

𝑣4 𝑒4 𝑣3

𝑒1 𝑒2 𝑒7
• 𝑣1 → 𝑣2 → 𝑣1 → 𝑣3 is a trial of length 3.
𝑒1 𝑒3 𝑒7 𝑒1
• 𝑣1 → 𝑣2 → 𝑣3 → 𝑣1 → 𝑣2 is not a trial since 𝑒1 is repeated.

The Open Univrsity of Sri Lanka 26


Definition 2.9

A walk is a finite alternating sequence of vertices and


edges, which is beginning and ending with a vertex,
so that each edge is incident with the vertices
preceding and following it, and any vertex or edge
can be appeared more than once.

In other words, a trial with repetition of edges are


allowed, is called a walk.

The Open Univrsity of Sri Lanka 27


Example
𝑒1
𝑣1 𝑣2
𝑒2

𝑒5 𝑒7 𝑒3
𝑒6

𝑣4 𝑒4 𝑣3

𝑒1 𝑒2 𝑒7
A walk of length 3 ∶ 𝑣1 → 𝑣2 → 𝑣1 → 𝑣3
𝑒1 𝑒7 𝑒7 𝑒1
A walk of length 4 ∶ 𝑣1 → 𝑣2 → 𝑣3 → 𝑣1 → 𝑣2
𝑒1 𝑒2 𝑒7 𝑒4 𝑒6
A walk of length 5 ∶ 𝑣1 → 𝑣2 → 𝑣1 → 𝑣3 → 𝑣4 → 𝑣4
The Open Univrsity of Sri Lanka 28
Definition 2.10

A trial is called a circuit if it’s both terminal vertices


are same.

➢ That is a circuit is a closed trial in which the


“first vertex = last vertex”.

The Open Univrsity of Sri Lanka 29


Example
𝑒1
𝑣1 𝑣2
𝑒2

𝑒5 𝑒7 𝑒3
𝑒6

𝑣4 𝑒4 𝑣3

𝑒1 𝑒2
𝑣1 → 𝑣2 → 𝑣1 is a circuit of length 2.

The Open Univrsity of Sri Lanka 30


Definition 2.11

A trial in which no vertex appear more than one is


called a path.

➢ That is a path is a trial with no repeated vertices.

The Open Univrsity of Sri Lanka 31


Example
𝑒1
𝑣1 𝑣2
𝑒2

𝑒5 𝑒7 𝑒3
𝑒6

𝑣4 𝑒4 𝑣3

𝑒1 𝑒3 𝑒4
• 𝑣1 → 𝑣2 → 𝑣3 → 𝑣4 is a path of length 3.
𝑒1 𝑒2 𝑒7
• 𝑣1 → 𝑣2 → 𝑣1 → 𝑣3 is a trial but not a path.
The Open Univrsity of Sri Lanka 32
Definition 2.12

A path is said to be a cycle if it is closed. A graph


containing at least one cycle is called a cyclic graph,
and otherwise the graph is called an acyclic graph.
Furthermore, a graph consisting of only a cycle with
vertices is called an 𝑛 − cycle and it is denoted by 𝐶𝑛 .

The Open Univrsity of Sri Lanka 33


Example
𝑒1
𝑣1 𝑣2
𝑒2

𝑒5 𝑒7 𝑒3
𝑒6

𝑣4 𝑒4 𝑣3

𝑒1 𝑒3 𝑒4 𝑒5
𝑣1 → 𝑣2 → 𝑣3 → 𝑣4 → 𝑣1 is a circuit of length 4.

The Open Univrsity of Sri Lanka 34


9.3.2 Connectedness

Definition 2.13

A graph (or multi-graph) 𝐺 is said to be a connected


graph if every pair of vertices can be connected by
a path in 𝑮. Otherwise it is called a disconnected
graph (or multi-graph).

The Open Univrsity of Sri Lanka 35


Example
𝑣1 𝑣5

𝑣3 𝑣4
𝑣2 𝑣6

Connected graph

𝑢2 𝑢4

𝑢1 𝑢3

Disconnected graph
The Open Univrsity of Sri Lanka 36
Theorem 2.4

A graph 𝐺 is disconnected if and only if its vertex set


𝑉(𝐺) can be partitioned in to two non empty, disjoint
subsets 𝑉1 and 𝑉2 so that there is no edge in 𝐸(𝐺)
whose one end in 𝑉1 and other end in 𝑉2 .

The Open Univrsity of Sri Lanka 37


Example
𝑢2 𝑢4

𝑢1 𝑢3

• In the graph 𝑉 𝐻 = {𝑢1 , 𝑢2 , 𝑢3 , 𝑢4 }.

• This can be partitioned in to two non-empty disjoint subsets.


𝑉1 = {𝑢1 , 𝑢2 , 𝑢3 }
𝑉2 = {𝑢4 }

• There are no edges among 𝑉1 and 𝑉2 .


The Open Univrsity of Sri Lanka 38
• Therefore the graph is disconnected.
Theorem 2.5

Let 𝐺 be a graph (or a multi-graph) with 𝑛 vertices.


Then any two vertices of 𝐺 are joined by a path of
length at most 𝒏 − 𝟏.

Proof
Proof is obvious.
Since the graph has 𝑛 vertices, the maximum number of
edges between two vertices is 𝑛 − 1.

The Open Univrsity of Sri Lanka 39


Theorem 2.6

Let 𝐺 be a graph (or a multi graph) with 𝑛 vertices.


(say 𝑉 𝐺 = {𝑣1 , 𝑣2 , ⋯ , 𝑣𝑛 }), A be the adjacency matrix
of 𝐺 and 𝑚 ∈ ℕ. If 𝐴𝑚 = (𝑐𝑖𝑗 ) then for each
𝑖, 𝑗 ∈ 1, ⋯ , 𝑛 , 𝐺 has 𝑐𝑖𝑗 number of walks between 𝑣𝑖
and 𝑣𝑗 with length 𝑚.

In other words, the 𝑖𝑗𝑡ℎ entry of 𝐴𝑚 gives the number


of walks between 𝑣𝑖 and 𝑣𝑗 with length 𝑚.

The Open Univrsity of Sri Lanka 40


Example

Let 𝐺 be a graph with 𝑉 𝐺 = 𝑣1 , 𝑣2 , 𝑣3 and its adjacency


matrix 𝐴 is as follows.
0 1 1
𝐴= 1 0 1
1 1 0

0 1 1 0 1 1 2 1 1
Then, 𝐴2 = 1 0 1 ⋅ 1 0 1 = 1 2 1
1 1 0 1 1 0 1 1 2

2 1 1 0 1 1 2 3 3
𝐴3 = 1 2 1 ⋅ 1 0 1 = 3 2 3
1 1 2 1 1 0 3 3 2
The Open Univrsity of Sri Lanka 41
Suppose 𝐴3 = (𝑐𝑖𝑗 ).
By the matrix, we have 𝑐12 = 3.
This says 𝐺 has 3 walks between 𝑣1 and 𝑣2 with the length 3.

𝑐12 = 3 𝐴3
𝑣2

𝑣1 𝑣3

3 walks are, • 𝑣1 , 𝑣3 , 𝑣1 , 𝑣2
• 𝑣1 , 𝑣2 , 𝑣1 , 𝑣2
• The𝑣1Open
, 𝑣2Univrsity
, 𝑣3 , 𝑣of2Sri Lanka 42
Theorem 2.7

Let 𝐺 be a graph (or a multi-graph) with 𝑛 vertices


(𝑛 > 1) and 𝐴 be the adjacency matrix of 𝐺. Then 𝐺 is
connected if and only if each and every entry of
𝐴 + 𝐴2 + ⋯ + 𝐴𝑛−1 is non zero.

The Open Univrsity of Sri Lanka 43


Example
Consider the previous example.

0 1 1
𝐴= 1 0 1
1 1 0

2 1 1
𝐴2 = 1 2 1
1 1 2

2 2 2
Then 𝐴 + 𝐴2 = 2 2 2 ≠ 0
2 2 2

Since 𝐴 + 𝐴2 is non zero the


The Open graph
Univrsity is connected.
of Sri Lanka 44

You might also like