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

Unit 3 – Session 3

Components of a Graph

C. P. S. Pathirana.
Senior Lecturer
Department of Mathematics & Philosophy of Engineering.
The Open University of Sri Lanka.
Components of a Graph

• Introduction

In this session we discuss sub graphs and connected


components of graphs.

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


10.1 Connected components

To discuss the component of a graph, we need to know the


idea of a sub-graph.

Recall - (sub-graphs)

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


graph of 𝐺 if 𝑉′ ⊆ 𝑉 and 𝐸 ′ ⊆ 𝐸.
Example 𝑣2 𝑣4

𝑣1 𝑣5
𝑣3
𝐺

𝑣4 𝑣2 𝑣4
𝑣2

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

𝐺1 and 𝐺2 are two subgraphs of 𝐺.


10.2 Distance and diameter of a graph
Definition

Let 𝐺 be a graph (or a multi-graph) and 𝑢, 𝑣 ∈ 𝑉 𝐺 . The


distance between 𝑢 and 𝑣 is the number of edges in the
shortest path between them, and it is denoted by
𝑑𝑖𝑠𝑡 𝑢, 𝑣 .

➢ If 𝑢 and 𝑣 belong to two distinct connected components,


then the distance is considered as infinite.

𝑑𝑖𝑠𝑡 𝑢, 𝑣 = ∞
Example
𝑣1

𝑣3 𝑣4 𝑣5

𝑣2

𝑑𝑖𝑠𝑡 𝑣1 , 𝑣2 = 1

𝑑𝑖𝑠𝑡 𝑣1 , 𝑣3 = 1

𝑑𝑖𝑠𝑡 𝑣1 , 𝑣4 = 2

𝑑𝑖𝑠𝑡 𝑣1 , 𝑣5 = ∞
Definition 3.3

Let 𝐺 be a connected graph (or connected multi graph).


The diameter of 𝐺 is the maximum distance between
any two vertices of 𝐺 and it is denoted by 𝑑𝑖𝑎𝑚 𝐺 .

𝑑𝑖𝑎𝑚 𝐺 = max 𝑑𝑖𝑠𝑡 𝑢, 𝑣 𝑢, 𝑣 ∈ 𝑉(𝐺)}.

➢ Diameter of a graph is the longest shortest path between


any two vertices of the graph.

➢ That is first find all the shortest paths and among them
choose the longest one.
Example 𝑣1 𝑣2
𝑣3 𝑣4

𝑣6 𝑣5
Now write the shortest paths between two vertices.

𝑑𝑖𝑠𝑡 𝑣1 , 𝑣2 =1 𝑑𝑖𝑠𝑡 𝑣1 , 𝑣5 =2 𝑑𝑖𝑠𝑡 𝑣1 , 𝑣4 = 3


𝑑𝑖𝑠𝑡 𝑣1 , 𝑣6 =1 𝑑𝑖𝑠𝑡 𝑣1 , 𝑣3 =2 𝑑𝑖𝑠𝑡 𝑣4 , 𝑣6 = 3
𝑑𝑖𝑠𝑡 𝑣2 , 𝑣5 =1 𝑑𝑖𝑠𝑡 𝑣2 , 𝑣6 =2
𝑑𝑖𝑠𝑡 𝑣5 , 𝑣6 =1 𝑑𝑖𝑠𝑡 𝑣2 , 𝑣4 =2
𝑑𝑖𝑠𝑡 𝑣2 , 𝑣3 =1 𝑑𝑖𝑠𝑡 𝑣3 , 𝑣6 =2
𝑑𝑖𝑠𝑡 𝑣3 , 𝑣5 =1 𝑑𝑖𝑠𝑡 𝑣4 , 𝑣5 =2
𝑑𝑖𝑠𝑡 𝑣3 , 𝑣4 =1
• Distance of longest shortest paths is 3.

• Therefore 𝑑𝑖𝑎𝑚 𝐺 = 3.
THANK YOU

You might also like