DM-Unit IV-Graph Th_final
DM-Unit IV-Graph Th_final
Graph Theory
Graph Terminology and Special Types of Graphs
Representing Graphs
Graph Isomorphism Connectivity
Euler and Hamilton Paths
The handshaking lemma
Single source shortest path-Dijkstra's Algorithm
Planar Graphs, Graph Colouring
Graph Terminology
• Mathematical structure which is used to show a particular function
with the help of connecting a set of points.
• To create a pairwise relationship between objects.
• Applications of Graph Theory
• Mathematics and Computer science
• Computer graphics and networks, biology
• GPS (Global positioning system)
Graph Terminology
Definition of Graph Theory
• a study of points and lines
• type of subfield that is used to deal with the study of a graph.
• graph theory is the study of the relationship between edges and vertices.
• a graph can be represented with the help of pair G(V, E).
V -the finite set vertices
E - the finite set edges.
• Hence, the graph basically contains the non-empty set of edges E and set
of vertices V.
• Ex: a graph G = (V, E), where
• V = {a, b, c, d}, and E = {(a, b), (a, c), (b, c), (c, d)}.
Graph Terminology(Examples)
Graph Terminology(Degree of a vertex)
• The number of edges connecting (Incident) to/on that vertex v with
self-loops counted twice
- deg(v)
The vertex 'a' has degree 5, and all the other vertices have a
degree 1.
If any vertex has degree 1, then that type of vertex will be
known as the 'end vertex'.
Graph Terminology(Degree of a vertex)
• Degree of a vertex in an Undirected graph(no directed edge)
Degree of vertex
Degree of a vertex v1 = deg(v1) = 1+2 = 3
Degree of a vertex v2 = deg(v2) = 1+3 = 4
Degree of a vertex v3 = deg(v3) = 1+2 = 3
Degree of a vertex v4 = deg(v4) = 5+0 = 5
Degree of a vertex v5 = deg(v5) = 1+2 = 3
Degree of a vertex v6 = deg(v6) = 0+0 = 0
Special Types of Graphs
• Different types of graphs depending upon the number of vertices,
number of edges, interconnectivity, and their overall structure
• Null Graph(Empty Graph):No edges between its vertices
• Trivial Graph
A trivial graph is the graph which has only one vertex.
Special Types of Graphs
• Simple Graph
• A simple graph is the undirected graph with no parallel edges and no
loops.
• n vertices, the degree of every vertex is at most n -1.
Special Types of Graphs
• Undirected Graph: edges are not directed.
• Connected Graph
• visit from any one vertex to any other vertex. at least one edge or
path exists between every pair of vertices.
Special Types of Graphs
• Disconnected Graph
• any path does not exist between every pair of vertices.
• 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.
• This graph always has two sets, X and Y, with the vertices.
• In this graph, the vertices of set X can only have a connection with the set
Y.
• We cannot join the vertices within the same set.
Special Types of Graphs
• Bipartite Graph
Special Types of Graphs
• Complete Bipartite Graph
• 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.
Special Types of Graphs
• Star Graph
• A star graph is a complete bipartite graph in which n-1 vertices have
degree 1 and a single vertex have degree (n -1). This exactly looks like
a star where (n - 1) vertices are connected to a single central vertex.
• A star graph with n vertices is denoted by Sn.
Special Types of Graphs
• Weighted Graph
• A weighted graph is a graph whose edges have been labeled with
some weights or numbers.
• The length of a path in a weighted graph is the sum of the weights of
all the edges in the path.
Special Types of Graphs
• Multi-graph
• A graph in which there are multiple edges between any pair of
vertices or there are edges from a vertex to itself (loop) is called
a multi - graph.
λ(G)) is 2
Vertex Connectivity
δ(G) = 3
K(G) ≥ 2 (2)
Therefore,
λ(G) = 2
-∑(deg(v)) -represents the sum of the degrees of all vertices in the graph
-deg(v)represents the degree of a vertex ‘v’
-E-represents the edges
Handshaking Theorem
Conclusions in the handshaking theorem
• There must be even numbers for the sum of degree of all the vertices.
• If there are odd degrees for all the vertices, then the sum of degree of
these vertices must always remain even.
• If there are some vertices that have an odd degree, then the number
of these vertices will be even.
Handshaking Theorem Proof
Applications of the Handshaking Theorem
• Computer Networking:
-To determine the total number of connections in a network.
-It helps in understanding the overall structure of the network
-Used to optimize its performance.
• Social Networks:
-To determine the number of connections between individuals.
-It helps in understanding the overall structure of the social network
- to identify influencers or key individuals in the network.
Examples
• Find the number of edges in a graph G with 10 vertices, where each
vertex has a degree of 3.
Examples
• Find the number of vertices in a graph G with 12 edges, where each
vertex has a degree of 2
Examples
• Find the sum of the degrees of all vertices in a graph
G with 7 edges and 5 vertices.
Examples
• Find the number of edges in a graph G with 6 vertices, where one
vertex has a degree of 4, two vertices have a degree of 3, and the
rest have a degree of 2.
Examples
Planar Graph
• A planar graph is a graph that we can draw in a plane in such a way
that no two edges of it cross each other except at a vertex to which
they are incident.
Planar Graph
• Region of a Graph: Consider a planar graph G=(V,E).A region is defined
to be an area of the plane that is bounded by edges and cannot be
further subdivided.
• A planar graph divides the plans into one or more regions.
• One of these regions will be infinite.
• Finite Region: If the area of the region is finite, then that region is
called a finite region.
• Infinite Region: If the area of the region is infinite, that region is
called a infinite region. A planar graph has only one infinite region.
Planar Graph
Properties of Planar Graphs:
Regions : r1,r2,r3,r4,r5
Finite regions :r2,r3,r4,r5
Infinite region, i.e., r1
Planar Graph
Example: Prove that complete graph K4 is planar.