0% found this document useful (0 votes)
148 views

Graph Theory

This document provides an introduction to graph theory concepts. It defines what a graph is consisting of vertices and edges. It then discusses various applications of graphs in areas like social networks, road maps, and more. The document goes on to define key graph theory terminology such as directed vs undirected graphs, degrees of vertices, planar vs non-planar graphs, and special graph types like trees, bipartite graphs, and regular graphs. Examples are provided to illustrate many of these concepts.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views

Graph Theory

This document provides an introduction to graph theory concepts. It defines what a graph is consisting of vertices and edges. It then discusses various applications of graphs in areas like social networks, road maps, and more. The document goes on to define key graph theory terminology such as directed vs undirected graphs, degrees of vertices, planar vs non-planar graphs, and special graph types like trees, bipartite graphs, and regular graphs. Examples are provided to illustrate many of these concepts.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 94

Graph Theory

Module-II
Discrete Mathematics

Kailash Kumar
Asst. Prof., CEA
GLAU, Mathura
Introduction
• Graphs are data structures consisting of
vertices and edges that connect these
vertices.

• Before going in details first of all we must


know the applications of graph

BCSC 0010 Discrete Mathematics 2


Applications of Graph
• to represent who influences whom in an
organization
• to model acquaintanceships between people
• to model roadmaps
• to represent the competition of different
species in an ecological niche

BCSC 0010 Discrete Mathematics 3


Applications of Graph
Using graph models, we can determine:
• whether it is possible to walk down all the streets
in a city without going down a street twice
• the number of colors needed to color the regions
of a map
• whether two computers are connected by a
communications link
• the shortest path between two cities in a
transportation network

BCSC 0010 Discrete Mathematics 4


Graph
• A graph G = (V, E) consists of V, a nonempty
set of vertices (or nodes) and E, a set of
edges.
• Each edge has either one or two vertices
associated with it, called its endpoints. An
edge is said to connect its endpoints.

BCSC 0010 Discrete Mathematics 5


Graph
The set of vertices V of a graph G may be infinite
• A graph with an infinite vertex set is called an
infinite graph.
• A graph with a finite vertex set is called a finite
graph.
Here, we consider only finite graphs

BCSC 0010 Discrete Mathematics 6


Graph

BCSC 0010 Discrete Mathematics 7


Terminologies
• A graph in which each edge connects two different vertices
and where no two edges connect the same pair of vertices is
called a simple graph.

• Multiple edges means more than one edge connecting the


same pair of vertices. These are called parallel edges.
• Graphs that contains some parallel edges are
called multigraphs.

BCSC 0010 Discrete Mathematics 8


Terminologies
• Edges that connect a vertex to itself are called
loops.
• Graphs that may include loops and multiple
edges are sometimes called pseudographs.

BCSC 0010 Discrete Mathematics 9


Terminologies
An edge which is associated with an unordered pair of
vertices is called an undirected edge
An undirected graph is a graph whose all edges are
undirected.

Eg.

(A,B) is same as (B,A)


It is called unordered pair as there is
no direction between vertex A and vertex B

BCSC 0010 Discrete Mathematics 10


Terminologies
An edge which is associated with an ordered pair
of vertices is called a directed edge
A directed graph is a graph whose all edges are
directed. Directed graph is also known as digraph.
Edges are directed by arrows.

Eg.
Since there is a direction between
Vertices. Vertices pairs are called ordered
pairs.
(A,B) is an ordered pair
(B,A) does not exist in this graph

BCSC 0010 Discrete Mathematics 11


Terminologies
• Formal Definition
• A directed graph (or digraph) (V, E) consists of
a nonempty set of vertices V and a set of
directed edges (or arcs) E. Each directed edge
is associated with an ordered pair of vertices.
The directed edge associated with the ordered
pair (u, v) is said to start at u and end at v.

BCSC 0010 Discrete Mathematics 12


Terminologies
• When a directed graph has no loops and has
no multiple directed edges, it is called as
simple directed graph.

• Directed graphs that may have multiple


directed edges from a vertex to a second
(possibly the same) vertex are called directed
multigraphs.

BCSC 0010 Discrete Mathematics 13


Terminologies

BCSC 0010 Discrete Mathematics 14


Terminologies
• Two vertices u and v in an undirected graph G
are called adjacent (or neighbours) in G if u
and v are endpoints of an edge of G. If e is
associated with {u, v}, the edge e is called
incident with the vertices u and v. The edge e
is also said to connect u and v. The vertices u
and v are called endpoints of an edge
associated with {u, v}.

BCSC 0010 Discrete Mathematics 15


Terminologies
• The degree of a vertex in an undirected graph
is the number of edges incident with it, except
that a loop at a vertex contributes twice to the
degree of that vertex. The degree of the
vertex v is denoted by deg(v).
• A vertex of degree zero is called isolated.
• A vertex is pendant if and only if it has degree
one.

BCSC 0010 Discrete Mathematics 16


BCSC 0010 Discrete Mathematics 17
Problem
• What are the degrees of the vertices in the
graphs G and H ?

BCSC 0010 Discrete Mathematics 18


THE HANDSHAKING THEOREM
• Let G = (V, E) be an undirected graph with e
edges. Then

Example :
How many edges are there in a graph with 10
vertices each of degree six?
Solution: Because the sum of the degrees of the
vertices is 6*10 = 60, it follows that 2e = 60.
Therefore, e = 30.
BCSC 0010 Discrete Mathematics 19
Terminologies
• When (u, v) is an edge of the graph G with
directed edges, u is said to be adjacent to v
and v is said to be adjacent from u.
• The vertex u is called the initial vertex of (u, v),
and v is called the terminal or end vertex of (u,
v). The initial vertex and terminal vertex of a
loop are the same.

BCSC 0010 Discrete Mathematics 20


Terminologies
In a graph with directed edges
• the in-degree of a vertex v, denoted by
is the number of edges with v as their terminal
vertex.
• the out-degree of v, denoted by is the
number of edges with v as their initial vertex.
• Note that a loop at a vertex contributes 1 to
both the in-degree and the out-degree of this
vertex.
BCSC 0010 Discrete Mathematics 21
BCSC 0010 Discrete Mathematics 22
Theorem
• Let G = (V, E) be a graph with directed edges.
Then

The sum of the in-degrees and the sum of the


out-degrees of all vertices in a graph with
directed edges are the same. Both of these sums
are the number of edges in the directed graph.
BCSC 0010 Discrete Mathematics 23
Types of Graph
• Directed Graph
• Complete Graph
• Bipartite Graph
• Isomorphic Graph
• Planar Graph
• Euler Graph
• Hamiltonian Graph

BCSC 0010 Discrete Mathematics 24


Some Special Simple Graphs
• Complete Graphs The complete graph on n
vertices, denoted by Kn , is the simple graph
that contains exactly one edge between each
pair of distinct vertices. The graphs Kn , for n =
1,2, 3, 4, 5, 6, are as follows:

BCSC 0010 Discrete Mathematics 25


Some Special Simple Graphs
• Cycles The cycle Cn ; n >= 3, consists of n
vertices v1, v2, ..., vn and edges {v1,v2},
{v2,v3}, ... , {vn-1,vn}, and {vn,v1}. The cycles
C3, C4 , C5, and C6 are as follows:

BCSC 0010 Discrete Mathematics 26


Some Special Simple Graphs
• Wheels We obtain the wheel Wn when we add
an additional vertex to the cycle Cn for n >=3,
and connect this new vertex to each of the n
vertices in Cn by new edges. The wheels W3,
W4, W5, and W6 are displayed as follows:

BCSC 0010 Discrete Mathematics 27


Some Special Simple Graphs
• n-Cubes The n-dimensional hypercube or n-cube,
denoted by Qn ; is the graph that has vertices
representing the 2n bit strings of length n. Two
vertices are adjacent if and only if the bit strings that
they represent differ in exactly one bit position. The
graphs Q1, Q2, and Q3 are displayed as follows:

BCSC 0010 Discrete Mathematics 28


n-Cubes continued..
• We can construct the (n+1)-cube Qn+1 from the n-
cube Qn by making two copies of Qn, prefacing
the labels on the vertices with a 0 in one copy of
Qn and with a 1 in the other copy of Qn, and
adding edges connecting two vertices that have
labels differing only in the first bit.
• Q3 is constructed from Q2 by drawing two copies
of Q2 as the top and bottom faces of Q3, adding 0
at the beginning of the label of each vertex in the
bottom face and 1 at the beginning of the label of
each vertex in the top face.
BCSC 0010 Discrete Mathematics 29
Some Special Simple Graphs
• Regular Graphs The regular graph is the
simple graph in which each vertex is of degree
k; this is denoted by k-regular graph.
• For example, the cycles Cn is the 2-regular
graphs, as each vertex is of degree 2.
• Complete graph Kn is (n-1)-regular graphs.

BCSC 0010 Discrete Mathematics 30


Bipartite Graph
• A simple graph G is called bipartite if its vertex
set V can be partitioned into two disjoint sets
V1 and V2 such that every edge in the graph
connects a vertex in V1 and a vertex in V2
• No edge in G connects either two vertices in
V1 or two vertices in V2
• When this condition holds, we call the pair
(V1, V2) a bipartition of the vertex set V of G.

BCSC 0010 Discrete Mathematics 31


Bipartite Graph
• Red vertices are in one set
• Black vertices are in another set

BCSC 0010 Discrete Mathematics 32


Bipartite Graph
• C6 (cycle graph of length 6) is bipartite, because
its vertex set can be partitioned into the two
sets V1 = {v1, v3, v5} and V2 = {v2, v4, v6}, and
every edge of C6 connects a vertex in V1 and a
vertex in V2.

BCSC 0010 Discrete Mathematics 33


Theorem
• A simple graph is bipartite if and only if it is
possible to assign one of two different colors
to each vertex of the graph so that no two
adjacent vertices are assigned the same color.

BCSC 0010 Discrete Mathematics 34


Complete Bipartite Graphs
• Complete bipartite graph Km,n is the graph
that has its vertex set partitioned into two
subsets of m and n vertices respectively, such
that every vertex of the first set is connected
to every vertex of the second set.

BCSC 0010 Discrete Mathematics 35


Complete Bipartite Graphs
• The complete bipartite graphs K2,3 , K3,3 , K3,5 ,
and K2,6 are as follows:

BCSC 0010 Discrete Mathematics 36


Subgraph
• A subgraph of a graph G = (V, E) is a graph
H = (W, F), where W  V and F  E . A subgraph
H of G is a proper subgraph of G if H  G
Eg. A subgraph of K5 is as follows:

BCSC 0010 Discrete Mathematics 37


Operations on graph
Union of graphs
• The union of two simple graphs G1 = (V1, E1)
and G2 = (V2, E2) is the simple graph with
vertex set V1 U V2 and edge set E1 U E2. The
union of G1 and G2 is denoted by G1 U G2.

BCSC 0010 Discrete Mathematics 39


Intersection of Graphs
• The intersection of two simple graphs G1 =
(V1, E1) and G2 = (V2, E2) is the simple graph
with vertex set V1 ∩ V2 and edge set E1 ∩ E2.
The intersection of G1 and G2 is denoted by
G1 ∩ G2.

BCSC 0010 Discrete Mathematics 40


Complement
• Complement of a simple graph G is a simple
graph G’ having-
1. All the vertices of G.
2. An edge between two vertices u and v iff there
exists no edge between u and v in the original
graph G.
• The sum of total number of edges in G and G’ is
equal to the total number of edges in a
complete graph i.e. n(n-1)/2 where n is number
of vertices in the graph
BCSC 0010 Discrete Mathematics 41
Complement

BCSC 0010 Discrete Mathematics 42


Isomorphism
• The simple graphs G1 = (V1, E1) and G2 = (V2, E2) are
isomorphic if there is a one-to-one and onto function
f from V1 to V2 with the property that a and b are
adjacent in G1 if and only if f(a) and f(b) are adjacent
in G2, for all a and b in V1. Such a function f is called
an isomorphism.
• In other words, when two simple graphs are
isomorphic, there is a one-to-one correspondence
between vertices of the two graphs that preserves
the adjacency relationship.
BCSC 0010 Discrete Mathematics 43
Graph Isomorphism Conditions
For any two graphs to be isomorphic, following 4
conditions must be satisfied-
1. Number of vertices in both the graphs must be same.
2. Number of edges in both the graphs must be same.
3. Degree sequence of both the graphs must be same.
4. If a cycle of length k is formed by the vertices { v1 ,
v2 , ….. , vk } in one graph, then a cycle of same length
k must be formed by the vertices { f(v1) , f(v2) , ….. ,
f(vk) } in the other graph as well.

Degree sequence of a graph is defined as a sequence


of the degree of all BCSC
the vertices in ascending order. 44
0010 Discrete Mathematics
Graph Isomorphism Conditions
• The above 4 conditions are just the necessary
conditions for any two graphs to be
isomorphic.
• They are not at all sufficient to prove that the
two graphs are isomorphic.
• If all the 4 conditions satisfy, even then it can’t
be said that the graphs are surely isomorphic.
• However, if any condition violates, then it can
be said that the graphs are surely not
isomorphic. BCSC 0010 Discrete Mathematics 45
Condition-01:
Number of vertices in graph G1 = 4
Number of vertices in graph G2 = 4
Number of vertices in graph G3 = 4
Condition-02:
Number of edges in graph G1 = 5
Number of edges in graph G2 = 5
Number of edges in graph G3 = 4
∴ G3 is neither isomorphic to G1 nor G2 , as the number of edges
are different but G1 may be isomorphic to G2.
BCSC 0010 Discrete Mathematics 46
Condition-03:
Degree Sequence of graph G1 = { 2 , 2 , 3 , 3 }
Degree Sequence of graph G2 = { 2 , 2 , 3 , 3 }
Here, Both graphs G1 and G2 have same degree sequence.
Condition-04:
Both the graphs contain two cycles each of length 3 formed by the
vertices having degrees { 2 , 3 , 3 }
It means both the graphs G1 and G2 have same cycles in them.
Thus, All the 4 necessary conditions are satisfied.
So, graphs G1 and G2 may be isomorphic.
BCSC 0010 Discrete Mathematics 47
Sufficient Conditions
If any one of these conditions satisfy, then the
graphs are surely isomorphic.
• Two graphs are isomorphic if and only if their
complement graphs are isomorphic.
• Two graphs are isomorphic if their adjacency
matrices are same.
• Two graphs are isomorphic if their corresponding
sub-graphs obtained by deleting some vertices of
one graph and their corresponding images in the
other graph are isomorphic.
BCSC 0010 Discrete Mathematics 48
Complement of Graphs G1 and G2 are
Clearly, Complement
graphs of G1 and G2
are isomorphic.
∴ Graphs G1 and G2
are isomorphic
graphs.
BCSC 0010 Discrete Mathematics 49
Problem
Show that the graphs G = (V, E) and H = (W, F),
displayed in Figure, are isomorphic.
Solution: The function f with f(u1) = v1,
f(u2) = v4, f(u3) = v3, and f(u4) = v2 is a
one-to-one correspondence between V
and W.
To see that this correspondence preserves
adjacency, note that adjacent vertices in G
are u1 and u2, u1 and u3, u2 and u4, and
u3 and u4, and each of the pairs f(u1) = v1
and f(u2) = v4, f(u1) = v1 and f(u3) = v3,
f(u2) = v4 and f(u4) = v2, and f(u3) = v3
and f(u4) = v2 are adjacent in H.
Therefore G&
BCSC 0010 Discrete H are isomorphic.
Mathematics 50
Problem

Show that the graphs shown above are not


isomorphic.
Solution: Both G and H have five vertices and six
edges. However, H has a vertex of degree one,
namely, e, whereas G has no vertices of degree
one. It follows that G and H are not isomorphic .
BCSC 0010 Discrete Mathematics 51
• Determine whether the graphs shown above are isomorphic.
• Solution: The graphs G and H both have eight vertices and 10
edges. They also both have four vertices of degree two and
four of degree three. Because these invariants all agree,
however, G and H are not isomorphic.
• To see this, note that because deg(a) = 2 in G, a must
correspond to either t, u, x, or y in H, because these are the
vertices of degree two in H. However, each of these four
vertices in H is adjacent to another vertex of degree two in H,
which is not true for aBCSC
in 0010
G.Discrete Mathematics 52
Planar Graphs
• A graph is called planar if it can be drawn in the
plane without any edges crossing (where a crossing
of edges is the intersection of the lines or arcs
representing them at a point other than their
common endpoint). Such a drawing is called a planar
representation of the graph.

BCSC 0010 Discrete Mathematics 53


Planar Graphs

BCSC 0010 Discrete Mathematics 54


Planar Graphs
• A graph may be planar even if it is usually drawn
with crossings, because it may be possible to draw
it in a different way without crossings.
• Is K4 planar?

K4 is planar because it can be


drawn without crossings

BCSC 0010 Discrete Mathematics 55


Planar Graphs
• Is K3,3 planar?

BCSC 0010 Discrete Mathematics 56


Planar Graphs
• Solution: Any attempt to draw K3,3 in the plane
with no edges crossing is doomed. We now show
why.
• In any planar representation of K3,3 ; the vertices
V1 and V2 must be connected to both V4 and V5.
These four edges form a closed curve that splits
the plane into two regions, R1 and R2.
• The vertex V3 is in either R1 or R2. When V3 is
in R2, the edges between V3 and V4 and between
V3 and V5 separate R2 into two subregions, R21
and R22. BCSC 0010 Discrete Mathematics 57
Planar Graphs
• Next, note that there is no way to place the
final vertex V6 without forcing a crossing.
• If V6 is in R1, then the edge between V6 and
V3 cannot be drawn without a crossing.
• If V6 is in R21 , then the edge between V2 and
V6 cannot be drawn without a crossing.
• If V6 is in R22, then the edge between V1 and
V6 cannot be drawn without a crossing.
• Therefore, K3,3 is not planar.
BCSC 0010 Discrete Mathematics 58
Planar Graphs
• A planar representation of a graph splits the
plane into regions, including an unbounded
region

• This is the basis for Euler’s Formula.


BCSC 0010 Discrete Mathematics 59
EULER'S FORMULA
• Let G be a connected planar simple graph with
e edges and v vertices. Let r be the number of
regions in a planar representation of G.
Then r = e - v + 2

BCSC 0010 Discrete Mathematics 60


Properties of Planar Graph
• In any planar graph, Sum of degrees of all the
vertices = 2 x Total number of edges in the
graph
• In any planar graph, Sum of degrees of all the
regions = 2 x Total number of edges in the
graph
• If G is a planar graph with k components, then
r = e – v + (k + 1)
BCSC 0010 Discrete Mathematics 61
Example
• Suppose that a connected planar simple graph has 20
vertices, each of degree 3. Into how many regions
does a representation of this planar graph split the
plane?
• Solution:
This graph has 20 vertices, each of degree 3, so v = 20.
Because the sum of the degrees of the vertices, 3*v =
3*20 = 60, is equal to twice the number of edges, 2e,
we have 2e = 60, or e = 30. (by Handshaking Theorem)
Consequently, from Euler's formula, the number of
regions is r = e - v + 2 = 30 - 20 + 2 = 12.
BCSC 0010 Discrete Mathematics 62
Connectivity
• A graph is said to be connected if there is a
path between every pair of vertex. From
every vertex to any other vertex, there should
be some path to traverse. That is called the
connectivity of a graph. A graph with multiple
disconnected vertices and edges is said to be
disconnected.

BCSC 0010 Discrete Mathematics 63


Cut Vertex
• Let G be a connected graph. A vertex V ∈ G is
called a cut vertex of G, if G-V (Delete V from
G) results in a disconnected graph.
• Removing a cut vertex from a graph breaks it
in to two or more graphs.
• Removing a cut vertex may render a graph
disconnected.
• A connected graph G may have at most (n–2)
cut vertices.
BCSC 0010 Discrete Mathematics 64
Cut Edge (Bridge)
• Let G be a connected graph. An edge 'e' ∈ G is
called a cut edge if G-{e} results in a
disconnected graph.
• If removing an edge in a graph results in to
two or more graphs, then that edge is called a
Cut Edge or Bridge.

BCSC 0010 Discrete Mathematics 65


Example

Cut Vertex: c or e

Cut Edge: {c, e}


BCSC 0010 Discrete Mathematics 66
Properties
Let G be a connected graph with n vertices, then
• a cut edge e ∈ G if and only if the edge 'e' is
not a part of any cycle in G.
• the maximum number of cut edges possible is
n-1.
• whenever cut edges exist, cut vertices also
exist because at least one vertex of a cut edge
is a cut vertex.
• if a cut vertex exists, then a cut edge may or
may not exist. BCSC 0010 Discrete Mathematics 67
Cut Set of a Graph
• Let G = (V, E) be a connected graph. A subset
E' of E is called a cut set of G if deletion of all
the edges of E' from G makes G disconnect.
• If deleting a certain number of edges from a
graph makes it disconnected, then those
deleted edges are called the cut set of the
graph.

BCSC 0010 Discrete Mathematics 68


Example

Cut Set:
•{e1, e3, e5, e8}
•{e1, e3, e6, e7}
•{e9}
•{e3, e4, e5}
•{e1, e2, e7}
•{e2, e3, e6}
BCSC 0010 Discrete Mathematics •{e1, e4, e8} 69
Walk in Graph Theory
• A walk is defined as a finite length alternating
sequence of vertices and edges.
• The total number of edges covered in a walk is
called as Length of the Walk.
• In graph theory, a walk is called as an Open
walk if:
– Length of the walk is greater than zero
– And the vertices at which the walk starts and ends
are different.
BCSC 0010 Discrete Mathematics 70
Walk in Graph Theory
• In graph theory, a walk is called as a Closed
walk if:
– Length of the walk is greater than zero
– And the vertices at which the walk starts and ends
are same.
• If length of the walk = 0, then it is called as
a Trivial Walk.
• Both vertices and edges can repeat in a walk
whether it is an open walk or a closed walk.
BCSC 0010 Discrete Mathematics 71
Example
• In this graph, few
examples of walk are-
• A,B,C,E,D
(Length = 4)
• D, B, A, C, E, D, E, C
(Length = 7)
• E,C,B,A,C,E,D
(Length = 6)

BCSC 0010 Discrete Mathematics 72


Path in Graph Theory
• In graph theory, a path is defined as an open
walk in which neither vertices (except possibly
the starting and ending vertices) nor edges are
allowed to repeat.
• In graph theory, a cycle is defined as a closed
walk in which neither vertices (except possibly
the starting and ending vertices) nor edges are
allowed to repeat.
• In graph theory, a closed path is called as a
cycle.
BCSC 0010 Discrete Mathematics 73
Path in Graph Theory
• In graph theory, a trail is defined as an open
walk in which vertices may repeat; but edges
are not allowed to repeat.
• In graph theory, a circuit is defined as a closed
walk in which vertices may repeat; but edges
are not allowed to repeat.
• In graph theory, a closed trail is called as a
circuit.

BCSC 0010 Discrete Mathematics 74


NOTES

BCSC 0010 Discrete Mathematics 75


Example-1
• Decide which of the
following sequences
of vertices determine
walks.
1. a , b , g , f , c , b
2. b , g , f , c , b , g , a
3. c , e , f , c For those that are walks,
4. c , e , f , c , e decide whether it is a
circuit, a path, a cycle or a
5. a , b , f , a
trail.
6. f , d , e , c , b BCSC 0010 Discrete Mathematics 76
Solution
1. a,b,g,f,c,b
2. b,g,f,c,b,g,a
3. c,e,f,c
4. c,e,f,c,e
5. a,b,f,a
6. f,d,e,c,b
1. Trail 2. Walk
3. Cycle 4. Walk
5. Not a walk 6. Path
BCSC 0010 Discrete Mathematics 77
Example-2
1. v1e1v2e2v3e2v2
2. v4e7v1e1v2e2v3e3
v4e4v5
3. v1e1v2e2v3e3v4e4
v5
4. v1e1v2e2v3e3v4e7
v1 Observe the given
5. v6e5v5e4v4e3v3e2 sequences and predict
v2e1v1e7v4e6v6 the nature of walk in
each case.
BCSC 0010 Discrete Mathematics 78
Solution
1. v1e1v2e2v3e2v2
2. v4e7v1e1v2e2v3e3
v4e4v5
3. v1e1v2e2v3e3v4e4
v5
4. v1e1v2e2v3e3v4e7
1. Open walk
v1 2. Trail (Not a path because
5. v6e5v5e4v4e3v3e2 3. Path
vertex v4 is repeated)

v2e1v1e7v4e6v6 4. Cycle
5. Circuit (Not a cycle because
vertex v4 is repeated)
BCSC 0010 Discrete Mathematics 79
EULER Path
• If there exists a walk in the connected graph
that visits every edge of the graph exactly
once with or without repeating the vertices,
then such a walk is called as an Euler walk.

• A graph will contain an Euler path if and only if


it contains at most two vertices of odd
degree.

BCSC 0010 Discrete Mathematics 80


EULER Circuit
• If there exists a walk in the connected graph
that starts and ends at the same vertex and
visits every edge of the graph exactly once
with or without repeating the vertices, then
such a walk is called as an Euler circuit.

• A graph will contain an Euler circuit if and only


if all its vertices are of even degree.

BCSC 0010 Discrete Mathematics 81


Example

Euler Circuit Euler Circuit Euler Circuit


does not exist ABCDFBEDA does not exist
BCSC 0010 Discrete Mathematics 82
EULER Graph
• Any connected graph is called as an Euler
Graph if and only if all its vertices are of even
degree.
• An Euler Graph is a connected graph that
contains an Euler Circuit.
Euler Circuit:
BACEDCB

BCSC 0010 Discrete Mathematics 83


Examples

Euler Graph Not Euler Graph


Euler Circuit:
AEDAFDCBA BCSC 0010 Discrete Mathematics 84
Examples

Not Euler Graph Not Euler Graph

BCSC 0010 Discrete Mathematics 85


Examples

Euler Graph Not Euler Graph

BCSC 0010 Discrete Mathematics 86


Hamiltonian Path
• If there exists a walk in the connected graph
that visits every vertex of the graph exactly
once without repeating the edges, then such a
walk is called as a Hamiltonian path.
• If there exists a PATH in the connected graph
that contains all the vertices of the graph, then
such a path is called as a Hamiltonian path.
• In Hamiltonian path, all the edges may or may
not be covered but edges must not repeat.
BCSC 0010 Discrete Mathematics 87
Hamiltonian Circuit/Cycle
• If there exists a walk in the connected graph
that visits every vertex of the graph exactly
once (except starting vertex) without repeating
the edges and returns to the starting vertex,
then such a walk is called as a Hamiltonian
circuit.
• If there exists a CYCLE in the connected graph
that contains all the vertices of the graph, then
that cycle is called as a Hamiltonian circuit.
BCSC 0010 Discrete Mathematics 88
Hamiltonian Circuit/Cycle
• A Hamiltonian path which starts and ends at the
same vertex is called as a Hamiltonian circuit.
• A closed Hamiltonian path is called as a Hamiltonian
circuit.
• Any Hamiltonian circuit can be converted to a
Hamiltonian path by removing one of its edges.
• Every graph that contains a Hamiltonian circuit also
contains a Hamiltonian path but vice versa is not
true.
• There may exist more than one Hamiltonian paths
and Hamiltonian circuits in a graph.
BCSC 0010 Discrete Mathematics 89
Example

Hamiltonian Circuit Hamiltonian Circuit Hamiltonian Circuit


ABCEDA does not exist does not exist
BCSC 0010 Discrete Mathematics 90
Hamiltonian Graph
• If there exists a closed walk in the connected
graph that visits every vertex of the graph
exactly once (except starting vertex) without
repeating the edges, then such a graph is
called as a Hamiltonian graph.

• Any connected graph that contains a


Hamiltonian circuit is called as a Hamiltonian
Graph.
BCSC 0010 Discrete Mathematics 91
Examples

No Hamiltonian Path No Hamiltonian Path


No Hamiltonian Circuit No Hamiltonian Circuit

BCSC 0010 Discrete Mathematics 92


Examples

Hamiltonian Path: Hamiltonian Path:


ABCDHGFE ABCDEFG
Hamiltonian Circuit: Hamiltonian Circuit:
ABCDHGFEA ABCDEFGA
BCSC 0010 Discrete Mathematics 93
Examples

No Hamiltonian Path Hamiltonian Path:


No Hamiltonian Circuit ABCDEFGHI
Hamiltonian Circuit:
BCSC 0010 Discrete Mathematics
ABCDEFGHIA 94

You might also like