Module 6 DSGT
Module 6 DSGT
Graph Theory
Degree of a Vertex − The degree of a vertex V of a graph G (denoted by deg (V)) is the number of edges incident
with the vertex V.
a 2 even
b 2 even
c 3 odd
d 1 odd
• Even and Odd Vertex − If the degree of a vertex is even, the vertex is called an
even vertex and if the degree of a vertex is odd, the vertex is called an odd
vertex.
• Degree of a Graph − The degree of a graph is the largest vertex degree of that
graph. For the above graph the degree of the graph is 3.
• The Handshaking Lemma − In a graph, the sum of all the degrees of all the
vertices is equal to twice the number of edges.
• The sum of the degrees of the vertices of a graph G=(V, E) is equal to twice the
number of edges in G. That is, ∑v ∈ Vd(v)=2 |E|
• TYPES OF GRAPH
Weighted Graphs
• Non-planer graph: A given graph will be known as the non-planer graph if it is
not drawn in a single plane, and two edges of this graph must be crossed each
other. The diagram of a non-planer graph is described as follows:
•
• Bipartite Graph
• A bipartite graph is a graph in which the vertex set can be partitioned into two
sets such that edges only go between sets, not within them.
• A graph G (V, E) is called bipartite graph if its vertex-set V(G) can be
decomposed into two non-empty disjoint subsets V1(G) and V2(G) in such a
way that each edge e ∈ E(G) has its one last joint in V1(G) and other last point
in V2(G).
• The partition V = V1 ∪ V2 is known as bipartition of G
• Example 1
•
Example 2
• Complete Bipartite Graph
• A complete bipartite graph is a bipartite graph in which each vertex in
the first set is joined to each vertex in the second set by exactly one
edge.
• A complete bipartite graph is a bipartite graph which is complete.
Walks, Trails, Path, Circuit and Cycle in Discrete
mathematics
• Walk:
• A walk can be defined as a sequence of edges and vertices of a graph. When
we have a graph and traverse it, then that traverse will be known as a walk. In
a walk, there can be repeated edges and vertices. The number of edges which
is covered in a walk will be known as the Length of the walk. In a graph, there
can be more than one walk.
• So for a walk, the following two points are important, which are described as
follows:
• Edges can be repeated
• Vertex can be repeated
• For example: In this example, we have a graph, which is described as follows:
•
• Types of Walks
• There are two types of the walk, which are described as follows:
1.Open walk
2.Closed walk
• Open Walk:
• A walk will be known as an open walk in the graph theory if the vertices at
which the walk starts and ends are different. That means for an open walk, the
starting vertex and ending vertex must be different. In an open walk, the length
of the walk must be more than 0.
• Closed Walk:
• A walk will be known as a closed walk in the graph theory if the
vertices at which the walk starts and ends are identical. That means
for a closed walk, the starting vertex and ending vertex must be the
same. In a closed walk, the length of the walk must be more than 0.
• 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.
• Here,
• This graph is a connected graph and all its vertices are of even degree.
• Therefore, it is an Euler graph.
•
• Alternatively, the above graph contains an Euler circuit BACEDCB, so it is an Euler graph.
• Euler path is also known as Euler Trail or Euler Walk.
• If there exists a Trail in the connected graph that contains all the edges of the
graph, then that trail is called as an Euler trail.
• OR
• 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.
▪ Euler circuit is also known as Euler Cycle or Euler Tour.
• If there exists a Circuit in the connected graph that contains all the edges of the graph, then that circuit is called as
an Euler circuit.
• OR
• 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.
• OR
• An Euler trail that starts and ends at the same vertex is called as an Euler circuit.
• OR
• A closed Euler trail is called as an Euler circuit.
• NOTE -A graph will contain an Euler circuit if and only if all its vertices are of even degree
• Euler paths and circuits :
• An Euler path is a path that uses every edge of a graph exactly once.
• An Euler circuit is a circuit that uses every edge of a graph exactly once.
• An Euler path starts and ends at different vertices.
• An Euler circuit starts and ends at the same vertex.
Example – Which graphs shown below have an Euler path or Euler circuit ?
•
•
• There are simple criteria for determining whether a multigraph has a Euler path or a Euler circuit. For any multigraph to
have a Euler circuit, all the degrees of the vertices must be even.
• Theorem – “A connected multigraph (and simple graph) with at least two vertices has a
Euler circuit if and only if each of its vertices has an even degree.”
• Proof of the above statement is that every time a circuit passes through a vertex, it adds twice to its degree. Since it is a
circuit, it starts and ends at the same vertex, which makes it contribute one degree when the circuit starts and one when
it ends. In this way, every vertex has an even degree.
Since the konigsberg graph has vertices having odd degrees, a Euler circuit does not exist in the graph.
• Theorem – “A connected multigraph (and simple graph) has an Euler
path but not an Euler circuit if and only if it has exactly two
vertices of odd degree.”
• The proof is an extension of the proof given above. Since a path may
start and end at different vertices, the vertices where the path starts
and ends are allowed to have odd degrees.
Example 1: In the following image, we have a graph with 4 nodes. Now we have to determine whether this
.
graph contains an Euler path
.
circuit
• The above graph will contain the Euler circuit if the starting
vertex and end vertex are the same, and this graph visits each
and every edge only once. The Euler circuit can contain the
repeated vertex. If we begin our path from vertex A and then go
to vertices C, D or C, E, then in this process, the condition of
• The above graph will contain the Euler path if each edge of this same start and end vertex is not satisfied, but another
graph must be visited exactly once, and the vertex of this can be condition of covering all edges is not satisfied. This is because if
repeated. So if we begin our path from A, then we can only go to we follow the path (A, C, D or A, C, E), many edges are repeated
vertex A, C, D or B, C, E. That means this graph cannot visit all in this process, which violates the Euler circuit. So if we try to
the edges only once. So the above graph does not contain an cover all the edges and vertices, the edges will be repeated. So
Euler path the above graph does not contain an Euler circuit .
Hamiltonian Graph Example-
• The following graph is an example of a Hamiltonian graph.
Here,
This graph contains a closed walk ABCDEFA.
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 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.
OR
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.
• NOTE: 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.
• 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.
OR
• 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.
OR
• A Hamiltonian path which starts and ends at the same vertex is called as a Hamiltonian circuit.
OR
• A closed Hamiltonian path is called as a Hamiltonian circuit.