Module 5.2 Graphs for Students
Module 5.2 Graphs for Students
2 3 2 3
(a) (b)
𝑽𝒊, 𝑽𝒋 𝑽𝒊 , 𝑽𝒋 ≠
For Directed Graphs:
E= are
𝑽𝒊 , 𝑽𝒋
E= 𝑽𝒊 , 𝑽𝒋
ordered pairs, For Undirected Graphs:
are
Preliminaries
Adjacent vertex: If two vertex are joined by the same
edge
(both the end points of one edge are adjacent vertex).
Adjacent edge: If two edges are incident on same vertex (if
two edges have one common vertex, then those edges are
adjacent edges.
Self loop: An edge with just one end-point.
Parallel edges: Two or more edges of a graph having
same end points.
a
1 4
A A B
(a) (b)
Self loop: An edge with just Parallel Edges: two or more edges of
one end-point a graph having same end points.
Types of
Graphs
Trivia Undirecte Directed Connected
Null Graph
l d Graph Graph Graph
Graph
Disconnect Regular Complete Cycle Cyclic
ed Graph Graph Graph Graph
Graph
Acycli Finite Infinite Bipartite Simple
c Graph Graph
Graph Graph Graph
Planar Wheel Multi- Pseudo Euler
Graph Graph Graph Graph Graph
Hamiltonian
Sub-Graph
Graph
Types of
Graphs 1. Trivial Graph (The smallest graph)
1 • Vertex set contains only one vertex.
• Edge set is empty, i.e. no edge.
2. Null Graph
1 3
• Vertex set is non-empty.
2
• Edge set is empty.
1 3 3. Finite Graph
• Vertex set is non-empty and finite.
2 • Edge set is non-empty and finite.
4. Infinite Graph
• Vertex set is non-empty and infinite.
• Edge set is non-empty and infinite.
Types of
Graphs
1
2
5. Simple Graph
• A graph without self loops and parallel edges.
4
3
1 3 6. Cyclic Graph
• A graph containing at-least one cycle.
2 4
1 3 7. Acyclic Graph
• A graph containing no cycle.
2 4
𝐾 𝐾
2 3
𝐾
4 6
3
Note:
1. No. of edges in regular graph =|E|=n*k/2
2. Every Complete Graph (degree (n-1)) is Regular Graph BUT every Regular Graph
is NOT Complete Graph.
Bipartite
A simple graph whose vertex set 𝑽can be partitioned
Graphs
into two subsets 𝑴 and 𝑵 (𝑽 = 𝑴 𝖴 𝑵) the
vertices of set 𝑴 only join with the vertices of set 𝑵.
1
V=7 5
2
6
3
7
4
M=4 N=3
Note:
1. Smallest possible graph that is NOT bipartite is
(𝑲 )
Complete Bipartite Graphs
whose vertex set 𝑽 can be partitioned
𝒎,𝒏
into two subsets 𝑴 and 𝑵 𝑽 = 𝑴 𝖴 𝑵 such that
A simple graph
3 2 5
2 4
2 6
3
𝐾2,
5
�3,
1 𝐾2, �3
3
1. Total no. edges in 𝑲𝒎,𝒏 = 𝒎 ∗ 𝒏.
Note:
𝑲𝟑,𝟑
means two different things.
1 1
3 3
𝐾
2 2
𝐾2,1
3
Not Bipartite • Bipartite
• Complete Bipartite
(𝑲𝒏 ) Vs
(𝑲𝒎,𝒏 )
1
4
2 5
6
𝐾
3
𝐾3,
6 3
Not Bipartite • Bipartite
• Complete Bipartite
Planar
Graph
Eg: 𝑲𝟒, 𝑸𝟑
A graph that can be drawn on a plane without
edges crossing is called planar graph.
𝑄
𝐾
3
4
A planar graph divides the plane into one or
more regions. One of these regions will be infinite.
Ex : 1 a 4 f 4 d 3d4 f
a
1 4
In WALK: c
A vertex CAN repeat b d
An edge CAN 3
2
repeat e
Note:
• Different names of Walk are Edge Train and Chain
• Length of the walk: |Number of edges covered in the walk|.
• Trivial Walk: Length of the walk =0
Open and Closed
• When a walk begins and ends at different vertices is
Walk
called Open Walk.
• When a walk begins and ends at same
vertices is called Closed Walk.
f
Ex : Open Walk: 1 a 4 f 4 d 3 a
1 4
Ex : Closed Walk: 1 a 4 f 4 c 2 b 1 c
b d
2 3
e
Trai
A trail is an open walk
lbut vertex can repeat. in which no edge is repeated
Ex : 1 a 4 f 4 d 3
f
a
1 4
In TRAIL: c
A vertex CAN repeat b d
An edge CANNOT repeat 3
2
e
Circuit
A circuit is a closed trail in which no edge
is repeated but vertex can repeat.
Ex : 1 a 4 f 4 d 3 e 2 b 1
f
a
1 4
In CIRCUIT: c
A vertex CAN repeat b d
An edge CANNOT repeat 3
2
e
Pat
An open walk in which no
hthan once is called as Path.vertex can appear more
Ex : 1 a 4 d 3
f
In PATH:
A vertex CANNOT repeat a
1 4
An edge CANNOT
repeat c
b d
Walk
2 3
Path e
f
Ex : 1 a 4 d 3 e 2 b 1
a
1 4
In CYCLE:
c
A vertex CANNOT repeat b d
An edge CANNOT 3
2
repeat e
Quiz 1
Every
Path Trai
l
Closed Closed
Every
Cycle Circuit
Note:
1. Every Path is a Trail
2. Every Cycle is a Circuit
Summarized
Vertex Edge
Walk Can Repeat Can Repeat
D C
Fig 1 Fig 2
Euler
Graph
Fig 2
Fig 3
Fig 4
Fig 5
Necessary and Sufficient
Condition
• For Eulerian Path: When only two vertices in the
connected graph has odd degree (any Euler path must
begin at one vertex with odd degree and end at the
other).
• For Eulerian Circuit: When every vertex in the connected
graph has even degree.
Note:
Every Euler Circuit has Euler Path BUT NOT vice versa.
Hamiltonian
Graph
• Hamiltonian Circuit is a circuit that traverses
each vertex in G exactly once.
• Hamiltonian Path is a path that traverses each vertex in
G exactly once.
Hamiltonian Graph: A connected graph 𝑮 is said to
be Hamiltonian Graph if we can traverse each vertex exactly
once.
Fig 1 Fig 2
Hamiltonian
Graph
Fig 3
Fig 2
𝒖 𝟏
3. will have a Hamiltonian Circuit if 𝒎 ≥�(𝒏� − 𝟑𝒏
and 𝒗 in 𝑮, then 𝑮 has Hamiltonian Circuit.
vertices of �
+ 𝟔) + 𝐝𝐞𝐠(𝐯) ≥𝒏
𝑮 𝒏
Let G be a linear graph of 𝒏 vertices, if 𝒎
�
−𝟏
If a connected graph has vertices and edges, then
𝒅𝐞𝐠If 𝐮
4. for
a connected graph 𝑮 has 𝒏 vertices & 𝒏 ≥ 𝟑 and 𝒅𝒆𝒈
it every pair of vertices, then there exists a Hamiltonian Circuit
5.
𝒗 ≥
𝒏 for every vertex then, 𝑮 has Hamiltonian Circuit.
6. If there is a vertexof degree 1
in a graph then it is impossible for the
GRAPH COLORING
APPLICATION
Graph Coloring
Problem
A coloring of a simple graph is the assignment of a
color to each vertex of the graph “such that no two
adjacent vertices are assigned the same color.”
1 2
M-Colorable and Chromatic
No.
• A graph G is called M-Colorable if it is possible to color
1 2
Chromatic No.= 3 Chromatic No.= 3
with 𝒏 vertices = 𝒏
Chromatic no. of completely connected graph
Fig 1
Graph
Isomorphism
If I take only 2 or 3 socks, it is possible that they are all different. For
example, they may be one red and one blue; or one red, one blue, and
one white. But if I take out 4 socks, these must include a matching pair.
Here the 4 chosen socks are the "objects" and the 3 colors are the
"boxes"; by PP1, it follows that at least two of the four chosen must
have the same color and hence must be a matching pair. Thus the