MODULE 4 – GRAPH THEORY
(PART – 2)
Dr V Bhuvaneswari
Assistant Professor
PSG College of Arts & Science
Coimbatore
WALKS, PATHS AND CIRCUITS
Walk:
A walk is defined as a finite alternating sequence
of vertices and edges beginning and ending with
vertex. (Vertex and Edges can be repeated in a
walk).
In the Graph,
v1 → e1 → v2 → e2 → v3 → e3 → v4 is a walk
v1 → e7 → v4 → e6 → v6 → e5 → v5 → e4 → v4
→ e3 → v3 is another walk.
LENGTH OF THE WALK:
The total number of edges covered in a walk is
called as Length of the Walk.
In the Graph,
v1 → e1 → v2 → e2 → v3 → e3 → v4 is a walk of
length three.
v1 → e7 → v4 → e6 → v6 → e5 → v5 → e4 → v4
→ e3 → v3 is a walk of length five.
Open Walk
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.
Closed Walk
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
Note
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.
PATH:
A path is defined as an open walk in which-
Neither vertices (except possibly the starting and
ending vertices) are allowed to repeat.
Nor edges are allowed to repeat.
In the graph,
v1 → e1 → v2 → e2 → v3 → e3 → v4 is a Path.
But v1 → e7 → v4 → e6 → v6 → e5 → v5 → e4 →
v4 → e3 → v3 is not a path because vertex v4 is
repeated.
Simple Path
A path is simple if no edge is repeated if it does
not include the same edge twice.
Elementary Path
A path is said to be elementary if it does not
meet the same vertex twice.
Consider the graph shown in fig:
Give an example of the following:
A simple path fromV1 to V6.
An elementary path from V1 to V6.
A simple path which is not elementary from V1 to
V6.
A path which is not simple and starting fromV2.
A simple path fromV1 to V6.
V1,V2,V3,V4,V5,V6.
An elementary path from V1 to V6.
V1,V2,V3,V5,V4,V6.
A simple path which is not elementary from V1 to
V6.
V1,V2,V3,V5,V2,V4,V6.
A path which is not simple and starting fromV2.
V2,V3,V4,V5,V3,V4,V6.
Cycle: A cycle is defined as a closed walk in which-
Neither vertices (except possibly the starting and ending
vertices) are allowed to repeat.
Nor edges are allowed to repeat.
OR
A closed path is called as a cycle.
In the graph,
v1 → e1 → v2 → e2 → v3 → e3 → v4 → e7 → v1 is a cycle.
Also, v4 → e6 → v6 → e5→ v5 → e4 → v4 a cycle.
But v1 → e7 → v4 → e6 → v6 → e5 → v5 → e4 → v4 → e3
→ v3 → e2 → v2 → e1 → v1 is not a cycle because vertex
v4 is repeated.
Trail:
A trail is defined as an open walk in which-
Vertices may repeat.
But edges are not allowed to repeat.
In the graph,
v1 → e7 → v4 → e6 → v6 → e5 → v5 → e4 → v4 →
e3 → v3 is a trail.
And v1 → e7 → v4 → e6 → v6 → e5→ v5 → e4 → v4
→ e3 → v3 → e2 → v2 → e1→ v1 is a closed trail.
Circuit:
A circuit is defined as a closed walk in which-
Vertices may repeat.
But edges are not allowed to repeat.
OR
A closed trail is called as a circuit.
In the above graph,
v1 → e7 → v4 → e6 → v6 → e5→ v5 → e4 → v4 →
e3 → v3 → e2 → v2 → e1 → v1 is a circuit.
USING THE GRAPH, CLASSIFY EACH SEQUENCE
AS A WALK, A PATH OR A CIRCUIT.
a) E → C → D → E
b) A → C → D → E → B → A
c) B → D → E → B → C
d) A → B → C → D → B → A
USING THE GRAPH, CLASSIFY EACH SEQUENCE
AS A WALK, A PATH OR A CIRCUIT.
a) E → C → D → E
b) A → C → D → E → B → A
c) B → D → E → B → C
d) A → B → C → D → B → A
DECIDE WHICH OF THE FOLLOWING
SEQUENCES OF VERTICES DETERMINE WALKS
For those that are
walks, decide whether
it is a circuit, a path, a
cycle or a trail.
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
DECIDE WHICH OF THE FOLLOWING
SEQUENCES OF VERTICES DETERMINE WALKS
For those that are Solution-
walks, decide whether 1. Trail
it is a circuit, a path, a 2. Walk
cycle or a trail.
3. Cycle
1. a , b , g , f , c , b
4. Walk
2. b , g , f , c , b , g , a
5. Not a walk
3. c , e , f , c
6. Path
4. c , e , f , c , e
5. a , b , f , a
6. f , d , e , c , b
CONNECTED & DISCONNECTED GRAPHS
A graph is said to be connected, if there is at
least one path between every pair of vertices.
A graph G which is not connected is said to be
disconnected.
Note that Complete graphs, complete bipartite
graphs, cyclic graphs and paths etc. are a few
examples of connected graphs.
Components : Each of the connected graphs is
called a component.
A graph G is connected iff it has exactly one
component.
A graph G is disconnected then G has at least two
components.
•G1 is a connected graph with
one component.
• G2 is a connected graph with
one component.
•G3 is a connected graph with
one component.
•G4 is a disconnected graph
with two components.
•G5 is a disconnected graph
with three components.
CONNECTEDNESS IN DIRECTED GRAPHS
Weakly connected: A digraph is weakly
connected if it is connected as an undirected
graph (a graph in which the direction of the edges
is neglected).
Unilaterally connected: If for any pair of
vertices of the graph at least one of the vertex of
the pair is reachable from the other.
Strongly connected: If for any pair of nodes of
the graph both the nodes of the pair are
reachable from one to another.
From the definition,
every strongly connected graph is unilaterally
connected and every
unilaterally connected graph is weakly connected
graph.
EXAMPLE
SHORTEST PATH IN WEIGHTED GRAPHS
EULER GRAPH
Euler Line: A closed walk covering all the edges
of the graph exactly once is called Euler line.
Euler Graph: A graph that consists of a Euler
line is called a Euler graph.
Note:
Any connected graph is called as a Euler Graph if
and only if all its vertices are of even degree.
A Euler Graph is a connected graph that contains a
Euler Circuit.
EXAMPLE
Here,
This graph is a connected graph and all its
vertices are of even degree.
Alternatively, the above graph contains a Euler
circuit B-A-C-E-D-C-B, so it is a Euler graph.
EULER PATH
Euler Path: A path that transverses each edge
in the graph once and only once.
Euler path is also known as Euler Trail or Euler
Walk.
EULER CIRCUIT:
A Euler graph is said to be a circuit that traverses each
edge in a graph once and only once.
UNDIRECTED GRAPH
An undirected graph possesses an eulerian
path if and only if it is connected and has either
zero or two vertices of odd degree.
An undirected graph possesses an eulerian
circuit if and only if it is connected and its
vertices are all of even degree.
DIRECTED GRAPH
A directed graph possesses an eulerian circuit if
and only if it is connected and the incoming degree
of every vertex is equal to its outgoing degree
A directed graph possesses an eulerian path if and
only if it is connected and the incoming degree of
every vertex is equal to its outgoing degree with
the possible exception of two vertices. For these
two vertices, the incoming degree of one is one larger
than its outgoing degree and the incoming degree of
the other is one less than its outgoing degree.
IMPORTANT NOTES
Note-01: To check whether any graph is a Euler
graph or not, any one of the following two ways may
be used
If the graph is connected and contains a Euler circuit, then
it is a Euler graph.
If all the vertices of the graph are of even degree, then it is
a Euler graph.
Note-02: To check whether any graph contains a
Euler circuit or not,
Just make sure that all its vertices are of even degree.
If all its vertices are of even degree, then graph contains a
Euler circuit otherwise not.
WHICH GRAPHS SHOWN BELOW HAVE A
EULER PATH OR EULER CIRCUIT?
G1 has two vertices of odd degree a and d and the
rest of them have even degree.
So, this graph has a Euler path but not a Euler
circuit. The path starts and ends at the vertices
of odd degree. The path is- a, c , d , a ,b , d .
G2 has four vertices all of even degree, so it has a
Euler circuit.
The circuit is –a, d , b, a, c, d, a .
WHICH OF THE FOLLOWING ARE EULER
GRAPHS?
WHICH OF THE FOLLOWING ARE EULER
GRAPHS?
If all the vertices of a
graph are of even degree,
then graph is an Euler
Graph otherwise not.
Using the above rule, we
have-
A) It is a Euler graph.
B) It is not a Euler
graph.
C) It is not a Euler
graph.
D) It is not a Euler
graph.
E) It is a Euler graph.
F) It is not a Euler
graph.
HAMILTONIAN GRAPHS
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.
This graph contains a closed walk A-B-C-D-E-F-A.
It visits every vertex of the graph exactly once except
starting vertex.
The edges are not repeated during the walk.
Therefore, it is a Hamiltonian graph.
Alternatively, there exists a Hamiltonian circuit
ABCDEFA in the above graph, therefore it is a
Hamiltonian graph.
HAMILTONIAN PATHS AND CIRCUITS
Hamiltonian paths
(circuits):
Hamiltonian paths
(circuits) is a path
(circuit) that passes
through each of the
vertices in a graph
exactly once.
In Hamiltonian path,
all the edges may or
may not be covered
but edges must not
repeat.
HAMILTONIAN CIRCUIT
Hamiltonian circuit is also
known as Hamiltonian
Cycle.
Hamiltonian Cycle in a
graph G is a circuit which
contains every vertex of G
exactly once.
OR
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.
RESULTS
A graph with a vertex of degree one cannot have
a Hamiltonian circuit.
No vertex in a Hamiltonian circuit is repeated
except the initial vertex.
Hamiltonian circuit in a graph of n vertices
consists of exactly n edges
Every graph that contains a Hamiltonian circuit
also contains a Hamiltonian path but vice versa
is not true.
Hamiltonian path in a graph G traverses every
vertex of G exactly once.
Length of the Hamiltonian path in a graph G of n
vertices is n-1
DOES THE FOLLOWING GRAPH HAVE A
HAMILTONIAN CIRCUIT?
No, the above graph does not have a Hamiltonian
circuit as there are two vertices with degree one
in the graph.
WHICH OF THE FOLLOWING ARE
HAMILTONIAN GRAPHS?
A) The graph neither
contains a
Hamiltonian path nor
it contains a
Hamiltonian circuit.
Since graph does not
contain a Hamiltonian
circuit, therefore It is
not a Hamiltonian
Graph.
No, the above graph
does not have a
Hamiltonian circuit as
there are four vertices
with degree one in the
graph.
The graph contains
both a Hamiltonian
path (ABCDHGFE)
and a Hamiltonian
circuit
(ABCDHGFEA). Since
graph contains a
Hamiltonian circuit,
therefore It is a
Hamiltonian Graph.
The graph contains
both a Hamiltonian
path (ABCDEFG) and
a Hamiltonian circuit
(ABCDEFGA). Since
graph contains a
Hamiltonian circuit,
therefore It is a
Hamiltonian
Graph.
The graph neither
contains a
Hamiltonian path nor
it contains a
Hamiltonian circuit.
Since graph does not
contain a Hamiltonian
circuit, therefore It is
not a Hamiltonian
Graph.
The graph contains
both a Hamiltonian
path (ABCDEFGHI)
and a Hamiltonian
circuit
(ABCDEFGHIA).
Since graph contains a
Hamiltonian circuit,
therefore It is a
Hamiltonian Graph.