Module 6 Graphs
Module 6 Graphs
Chapter 8
Varying Applications (examples)
• Computer networks
• Distinguish between two chemical compounds with
the same molecular formula but different structures
• Solve shortest path problems between cities
• Scheduling exams and assign channels to television
stations
Topics Covered
• Definitions
• Types
• Terminology
• Representation
• Sub-graphs
• Connectivity
• Hamilton and Euler definitions
• Isomorphism of Graphs
• Planar Graphs
Definitions - Graph
u v
u v
Definitions – Graph Type
Simple (Undirected) Graph: consists of V, a nonempty set
of vertices, and E, a set of unordered pairs of distinct
elements of V called edges (undirected)
w
Definitions – Graph Type
Directed Graph: G(V, E), set of vertices V, and set of Edges E,
w
• Degree of a vertex: Number of edges having that
vertex as an end point
• Loop: A graph may contain an edge from a vertex to
itself referred to as a loop
Isolated vertex: Vertex with degree 0
• Adjacent vertices : A pair of vertices that determine
an edge
• For V = {u, v, w} ,
E = { {u, w}, {u, w}, (u, v) },
deg (u) = 2, deg (v) = 1, deg (w) = 1, deg (k) = 0,
• k is isolated
u v
k
w
Terminology – Directed graphs
• In-degree (u): number of in coming edges
indeg(v) = 1, outdeg(v)= 1
u v
w
Types of Graphs
L2 L3
• Linear Graph
• Discrete Graph (only vertices , no edges )
D2 D4
c c c c c c
• Complete Graph
• Connected Graph
COMPLETE GRAPH
• Complete graph: Kn, where every vertex is connected to
every other vertex
K1 K2 K3
K4
Representation Example: K1, K2, K3, K4
CONNECTED GRAPH
• If there is a path from any vertex to any other
vertex in the graph
• Otherwise it is a disconnected graph(various
connected pieces are called components of
graph)
u
v w
Problem
Determine whether the graph is connected or
disconnected. If disconnected find its connected
component.
11/11/2022 17
Labelled and weighted graph
A graph G is called a labelled graph it its edges and /or vertices
are assigned data of one kind or another. In particular, G is called
a weighted graph if each edge 'e' of G is assigned a non–
negative number called the weight or length of V.
11/11/2022 18
Subgraphs
u u u
v w v w v
G H1 H2
Subgraph
Let G = (V, E, ) is a graph. Choose a subset E1 of the edges in E and a subset V1 of the
(a) vertices in V. So that V1 contains all the end points of edges in E1. Then H = (V1, E1, 1)
is also a graph, where 1 is restricted to edges in E1. Such a graph H is called a
subgraph of G.
(b)
11/11/2022 20
Spanning Subgraph
A subgraph is said to be spanning subgraph if it
contains all the vertices of G.
11/11/2022 21
Complement of Subgraph
The complement of a subgraph G' = (V', E') with respect to the
graph G = (V, E) is another subgraph
G" = (V", E") such that E" is equal to E – E' and V" contains only
the vertices with which the edges in E" are incident.
11/11/2022 22
Complement of Subgraph
u u u
v
w v w v
G H1 H2
11/11/2022 23
Find Sub graphs of G
Compliment of Sub Graph
u u u
v w v w v
G H1 H2
Handshaking Lemma
Consider a Graph G with e nos of edges and n
nos of vertices , the sum of the degrees of all
vertices in G is twice the nos of edges in G
n
∑ d( vi) = 2 e
i=1
Problems
• Determine the number of edges in a graph with 6 nodes in
which 2 of degree 4 and 4 of degree 2. Draw two such graphs
• EULER PATH
– A path in a graph G is called an Euler path if it
includes every edge exactly once
• EULER CIRCUIT
– A Euler path that is a circuit
Theorem: EULER CIRCUIT
All vertices
have odd
degree
Two vertices
have odd
degree
HAMILTONIAN PATH AND CIRCUIT
Hamiltonian path : c, d, e, b, a
Hamiltonian circuit : c, d, e , b, a, c
Eulerian path : (e, d, b, a, d, c, a, e, b)
11/11/2022 41
Identify Euler path, circuit,
Hamiltonian path and circuit
(a)
(b)
11/11/2022 42
Identify Euler path, circuit,
Hamiltonian path and circuit
Number of vertices is 6. Each vertex has
degree greater than equal to 6/2. So there
is an Hamiltonian circuit.
: 1, 4, 5, 6, 3, 2, 1
11/11/2022 43
Identify Euler path, circuit,
Hamiltonian path and circuit
(i) Eulerian Path : : a, b, c, d, b, f, d, a, f, e, d
G has 2 vertices of odd degree.
Hamiltonian Circuit : a, b, c, d, e, f, a.
Hamiltonian Path : a, b, c, d, e, f
11/11/2022 44
• Function f is called isomorphism
• Same nos of vertices
• Same nos of edges
• Equal nos of vertices with a given degree
• Adjacency of vertices
Graph - Isomorphism
u1 u2 v1 v2
u3 u4 v4
v3
Isomorphism of Graphs
•Example I: Are the following two graphs isomorphic?
a
a
b e e
b
c d
c d
Solution: Yes, they are isomorphic, because they can be arranged to look identical.
You can see this if in the right graph you move vertex b to the left of the edge {a, c}.
Then the isomorphism f from the left to the right graph is: f(a) = e, f(b) = a,
f(c) = b, f(d) = c, f(e) = d.
Isomorphism of Graphs
•Example II: How about these two graphs?
a
a
b
e e
c c
d d
Solution: No, they are not isomorphic, because they differ in the degrees of their
vertices.
Vertex d in right graph is of degree one, but there is no such vertex in the left
graph.
• A is adjacent
to: B, C, D
• B is adjacent
to: A, C, E
C is adjacent
to: A, B
D is adjacent
to: A, E
E is adjacent
to: B, D
Both graphs contain
8 vertices and 10 edges
Nos of vertices of degree 2 = 4
Nos of vertices of degree 3 = 4
Adjacency : There exists no
vertex of degree 3 whose
adjacent vertices have same
degree in both graphs
So its not ISOMORPHIC
Isomorphism of Graphs
Example IV: Are the following two graphs isomorphic?
11/11/2022 51
Isomorphism of Graphs
Example V: Are the following two graphs isomorphic?
11/11/2022 52
Isomorphism of Graphs
Example VI: Are the following two graphs isomorphic?
11/11/2022 53
Planar Graphs
• A graph (or multigraph) G is called planar if G can be drawn
in the plane with its edges intersecting only at vertices of G,
such a drawing of G is called an embedding of G in the plane.
K4
Planar Graphs
• Representation examples: Q3
Planar Graphs
Theorem : Euler's planar graph theorem
number
number number of regions
of vertices of edges
Planar Graphs
R1
K4 R4
R2
A planar graph divides the plane
into several regions (faces), one
R3 of them is the infinite region.
v=4,e=6,r=4, v-e+r=2
Examples
11/11/2022 60
Planar Graphs Example
11/11/2022 61
Q. 1) By drawing the graph, show that following graphs are planar graphs
11/11/2022 62
Q. 2 : How many edges must a planar graph have if it has 7 regions and 5 nodes.
Draw one such graph.
Soln. :
According to Euler's formula, in a planar graph
v–e+r = 2
where v, e, r are the number of vertices, edges and regions in a planar graph.
Here v = 5, r =7, e = ?
v – e + r =2
5 – e + 7=2
e=10
Hence the given graph must have 10 edges.
11/11/2022 63
Q. 3 : Determine the number of regions defined by a connected planar graph with
6 vertices and 10 edges. Draw a simple and a multi-graph.
Soln. :
Given v = 6, e = 10
Hence by Euler's formula for a planar graph
v – e + r =2
6 – 10 + r=2
r=6
Hence the graph should have 6 regions.
11/11/2022 65
Ex. 5 : Suppose that a connected planer graph has 20 vertices, each of degree 3
into how many regions does a representation of this plan graph split the plane ?
Soln. :
| V |=20 = number of vertices
degree of each vertex = 3
By hand shaking Lemma
Σ d(Vi) = 2e
20 3 = 2e
e = 30
By Euler's theorem,
| V | – | E | + | R |=2
20 – 30 + | R |=2
| R |=12
11/11/2022 66