0% found this document useful (0 votes)
21 views39 pages

DM-UNIT-6

The document covers various concepts in graph theory, including definitions of graphs, types of graphs, and properties such as degree, regular graphs, and complete graphs. It also discusses graph representations, isomorphism, and theorems related to the sum of degrees and degree sequences. Additionally, it provides examples and exercises to illustrate these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views39 pages

DM-UNIT-6

The document covers various concepts in graph theory, including definitions of graphs, types of graphs, and properties such as degree, regular graphs, and complete graphs. It also discusses graph representations, isomorphism, and theorems related to the sum of degrees and degree sequences. Additionally, it provides examples and exercises to illustrate these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

UNIT-6:Graph Theory

 Basic concepts
 Representation of Graphs
 Isomorphism and Sub graphs
 Spanning trees
 Planar graphs
 Multi graphs and Euler Circuits
 Hamiltonian graphs
 Chromatic number
Basic concepts and notations.
 A Graph G is a pair of sets (V, E)
 where V = A set of vertices (nodes) and
 E = A set of edges (lines)
 V(G) = Set of vertices in G.
 E(G) = Set of edges in G.
 V(G)  = Number of vertices in graph G = Order of G.
 E(G)  = Number of edges in graph G = Size of G .
Types of graphs
 Non Directed Graph (Undirected graph): The elements of E
are unordered pairs (sets) of vertices. In this case an edge {u, v} is
said to join u and v or to be between u and v.
 Directed Graph: In a digraph the elements of E are ordered pairs
of vertices. In this case an edge (u, v) is said to be from u to v.

 Loop: An edge drawn from a vertex to itself.


 Multi Graph: If one allows more than one edge to join a pair of
vertices, the result is then called a multi graph.

Simple Graph: A graph with no loops and no parallel


edges.
Definitions
 Degree: 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).
 In-degree and Out-degree: In a digraph, the number of edges
incident to a vertex is called the in-degree of the vertex and the
number of vertices incident from a vertex is called its out-degree.
 The in-degree of a vertex ‘v’ in a graph G is denoted by deg+(v) .
 The out-degree of a vertex v is denoted by deg -(v).
 A loop at a vertex in a digraph is counted as one edge for both
in-degree and out-degree of that vertex.
 Neighbors: If there is an edge incident from u to v, or incident on
u and v, then u and v are said to be adjacent ( neighbors).
 (G) = minimum of all the degrees of vertices in a graph G.
 (G) = Maximum of all the degrees of vertices in a graph G.
Regular Graph: In a graph G, if (G) = (G) = k i.e., if each
vertex of G has degree k, then G is said to be a regular graph of
degree k (k-regular).
 Ex: Polygon is a 2-regular graph .
 Ex: A 3-regular graph is a cubic graph.

Complete Graph: A simple non directed graph with ‘n’


mutually adjacent vertices is called a complete graph on ‘n’ vertices
and may be represented by Kn.
Note: A complete graph on ‘n’ vertices has [{n(n – 1)}/ 2]edges, and
each of its vertices has degree ‘n-1’.
Every complete graph is a regular graph.
The converse of the above statement need not be true.
 Cycle Graph: A cycle graph of order ‘n’ is a connected graph
whose edges form a cycle of length n.
 Note: A cycle graph ‘Cn’ of order n has n vertices and n edges.
 Null Graph: A null graph of order n is a graph with n vertices and
no edges.
 Wheel Graph: A wheel graph of order ‘n’ is obtained by adding a
single new vertex (the hub) to each vertex of a cycle graph of
order n-1.
 Note: A wheel graph Wn has ‘n’ vertices and 2(n-1) edges.
 Bipartite Graph: A Bipartite graph is a non directed graph
whose set of vertices can be partitioned in to two sets M and N in
such a way that each edge joins a vertex in M to a vertex in N.
 Complete Bipartite Graph: A complete Bipartite graph is a
Bipartite graph in which every vertex of M is adjacent to every
vertex of N.
 If M = m and N  = n then the complete Bipartite graph is
denoted by Km , n. It has ‘m n’ edges.
 The number of edges in a bipartite graph is  (n2/4).

Degree Sequence: If v1, v2, ……, vn are the vertices of a


graph G, then the sequence{d1, d2,….., dn} where di =
degree of vi is called the degree sequence of G.
Usually we order the degree sequence so that the degree
sequence is monotonically decreasing.
First theorem on graph theory

 Sum of Degrees Theorem: If V = {v1, v2, ….., vn} is the vertex set
of a non directed graph G then

  deg (vi) = 2.  E
n
 iProof:
=1 When the degrees are summed, each edge contributes a
count of one to the degree of each of the two vertices on which
the edge is incident.
 Hence, the theorem follows.
Corrollories

 Cor. 1 If G is a digraph, then

  deg+(vi) =  deg –(vi) =  E


n n
 Cor.2. An undirected
i=1 graph hasi=1
an even number of vertices of odd
degree. (See Text book for proof)
 Cor.3 If G is a k– regular graph , then k. V = 2.  E .

 Cor.4 In a non directed graph G, If k = (G) and m = (G) then


 k. V  2. E  m .V

Examples

 Ex. A non directed graph contains 16 edges and all vertices are of
degree 2. Find the number of vertices in G ?
 Solution: By Sum of degrees theorem, if degree of each vertex is k,
then
 k. V = 2. E
  2.  V = 2.(16)
   V = 16
Example

 Ex. A simple non directed graph G contains 21 edges, 3 vertices of


degree 4 and the other vertices are of degree 2. Find the number of
vertices in the graph G ?
 Solution: Let  V = n . By Sum of degrees theorem,

  deg (vi) = 2.  E
n

 i=1 3.(4) + (n – 3 ). 2 = 2.(21)
  n = 18.
Ex.What is the number of vertices in an undirected connected graph
with 27 edges, 6 vertices of degree 2, 3 vertices of degree 4 and
remaining vertices of degree 3?
 Solution: Let  V = n . By Sum of degrees theorem,

  deg (vi) = 2.  E

  6.(2) + 3.(4) + (n – 9 ). 3 = 2.(27)


  n = 19.
Ex. If a simple non directed graph G contains 24 edges and all vertices
are of same degree then find the number of vertices in G?

 Solution: By Sum of degrees theorem, if degree of each vertex is k,


then
 k. V = 2. E
  k.  V = 2.(24)
   V = 48/k ( k = 1,2,3,4,6,8,…)
  V(G) = 48, 24, 16, …
Ex. What is the largest possible number of vertices in a graph G, with
35 edges and all vertices are of degree at least 3 ?.

 Solution: By Sum of degrees theorem, if degree of each vertex is 


k, then
 k. V  2. E
  3. V  2.(35)
   V  (70/3 = 23.33..)
   V  23
  The largest possible number of vertices = 23
Example

 Ex. Let G be a simple graph with n vertices. Then show that the
number of edges in G is less than or equal to {n.(n – 1)} / 2.

 Solution: In a simple graph, each edge correspond to a distinct pair of


vertices.
 The number of ways to choose a pair of vertices, out of n vertices =
 C(n , 2) = n. (n – 1 )
 2
 The maximum number of edges possible in G = {n.(n – 1)} / 2.
  The number of edges in G is less than or equal to {n.(n – 1)} / 2.
Ex. Which of the following degree sequences represent a simple non directed
graph
a) {2, 3, 3, 4, 4, 5} b) {2, 3, 4, 4, 5}
c) {1, 3, 3, 4, 5, 6, 6} d) {1, 3, 3, 3}
 Solution: a) Consider the degree sequence {2, 3, 3, 4, 4, 5}
 Here, we have 3 vertices with odd degree.
 But, By sum of degrees theorem, An undirected graph should
contain an even number of vertices of odd degree.
  The degree sequence cannot represent a simple non directed
graph.

 b) Consider the degree sequence {2, 3, 4, 4, 5}


 Here, we have a vertex with degree 5.
 But, A simple non directed graph of order 5 cannot have a vertex
with degree 5.
  The degree sequence cannot represent a simple non directed
graph.
Contd.,

 c) Consider the degree sequence {1, 3, 3, 4, 5, 6, 6}


Here, the order of the graph is 7 and we have 2 vertices with degree 6.
 Since these two vertices are adjacent to all other vertices of the graph, a
vertex with degree 1 does not exist
  The degree sequence cannot represent a simple non directed graph.

 d) Consider the degree sequence {1, 3, 3, 3 }


Here, the order of the graph is 4 and we have 3 vertices with degree 3.
 Since these 3 vertices are adjacent to all other vertices of the graph, a
vertex with degree 1 does not exist.
  The degree sequence cannot represent a simple non directed graph.
Ex. Show that a degree sequence with all distinct elements cannot
represent a simple non directed graph.

 Solution: Let G = {v1,v2,v3,…,vn}


 The possible degree sequences are {0,1,2,….,n –1} and {1,2,3,…,n}
 In a simple graph of order n, if there is a vertex with degree n – 1
then a vertex with degree 0 does not exist.
 A simple non directed graph of order ‘n’ cannot have a vertex with
degree n.
  The degree sequence with all distinct elements cannot represent
a simple non directed graph.
Representation of Graphs

 Adjacency list: One way to represent a graph with no multiple edges is


to use adjacency lists, which specify the vertices that are adjacent to
each vertex of the graph.
 1) Adjacency matrix: The adjacency matrix of a graph is a
 matrix with rows and columns labeled by the vertices and such that
 its entry in row i, column j is 1 otherwise it is 0
 For instance the following is the adjacency matrix of the graph of
figure
2) Incidence matrix: The incidence matrix of a graph G is
a matrix with rows labeled by vertices and columns
labeled by edges, so that entry for row v column e is 1 if e
is incident on v, and 0 otherwise. As an example, the
following is the incidence matrix of graph of figure
Path Matrix
Isomorphism
 Isomorphic Graphs: Two graphs G and G1 are isomorphic if there
is a function f : V(G)  V(G1) such that
 (i) f is a bijection and
 (ii) for each pair of vertices u and v of G,
 {u, v}  E(G)  {f(u), f(v)}  E(G1)
 i.e.. the function preserves adjacency.
 Note: If G is isomorphic to G1 then
 a)  V(G) =  V(G1)
 b)  E(G) =  E(G1)
 c) The degree sequences of G and G1 are same.
 d) If {v, v} is a cycle in G, then {f(v), f(v)} is a loop in G1, and more
generally, if v0 – v1 – v2 – …. – vk – v0 is a cycle of length k in G, then
f(v0)– f(v1)– f(v2) – … – f(vk) – f(v0) is a cycle of length k in G1.
Isomorphism
 Suppose G and G1 are two graphs and that f : V(G)  V(G1) is a
bijection.
 Let A be the adjacency matrix for the vertex ordering v1, v2, ……,vn of
the vertices of G.
 Let A1 be the adjacency matrix for the vertex ordering
 f(v1), f(v2), ….. , f(vn) of the vertices of G1.
 Then f is an isomorphism from V(G) to V(G1) iff the adjacency
matrices A and A1 are equal.
 Note: If A  A1, then it may still be the case that graphs G and G1 are
isomorphic under some other function.
Isomorphism

 Complement of a graph: The complement of a graph G is the


graph G with the same vertices as G. An edge exists in G iff it does
not exist in G.
 Theorem: Two simple graphs are isomorphic iff their complements are
isomorphic.
 If two graphs are isomorphic, then their corresponding sub graphs are
isomorphic.
 Induced Subgraph: If W is a subset of V(G), then the sub graph
induced by W is the sub graph H of G obtained by taking V(H) = W
and E(H) to be those edges of G that join pairs of vertices in W.
 If G is isomorphic to G1 then G is said to be self
complementary.
Isomorphism
 Ex. If G is self complementary graph with n vertices, then show that
G has {n(n – 1)}/4 edges.
 Ex. If G is self complementary then prove that G has 4k or 4k + 1
vertices where k is some positive integer.
 Ex. How many non isomorphic graphs are there of order 4 and size 2?
 Ex. How many non isomorphic graphs are there of order 8, size 8 and
degree sequence {2,2,2,2,2,2,2,2}.
 Ex. How many non isomorphic graphs are there of order 6, size 6 and
degree sequence {2, 2, 2, 2, 2, 2}.
 Ex. Let Cn be a cycle graph on n vertices. if Cn is isomorphic to Cn
then show that n = 5.
Spanning Trees
 Tree: A connected graph with no cycles is called a tree.
 A tree with ‘n’ vertices has (n – 1) edges.
 A tree with n vertices (n>1) has at least two vertices of degree 1.
 A sub graph H of a graph G is called a spanning tree of G if
i) H is a tree and
ii) H contains all vertices of G
 Note: In general, if G is a connected graph with n vertices and m
edges, a spanning tree of G must have (n – 1) edges. Therefore, the
number of edges that must be removed before a spanning tee is
obtained must be m – (n – 1). This number is called circuit rank of G.
 A non directed graph G is connected iff G contains a spanning tree.
 The complete graph Kn has nn – 2 different spanning trees.
(Caley’s formula)
Minimal Spanning Tree: Let G be a connected graph where each
edge of G is labeled with a non negative cost. A spanning tree T where
the total cost C(T) is minimum is called a minimal spanning tree.
 Kruskal’s Algorithm: (For finding minimal spanning tree of a
connected weighted graph)
 Input: A connected graph G with non negative values assigned to
each edge.
 Output: A minimal spanning tree for G.
 Method: 1) Select any edge of minimal value that is not a loop.
This is the first edge of T(if there is more than one edge of
minimal value, arbitrary choose one of these edges)
 2) Select any remaining edge of G of having minimal value that does
not form a circuit with the edges already included in T.
 3) Continue step 2 until T contain (n – 1) edges when n = |V(G)|
Prim’s algorithm.
 Prim’s Algorithm: (For finding a minimal spanning tree)
 1) Let G be a connected graph with non negative values assigned to
each edge. First let T be the tree consisting of any vertex V1 of G.
 2) Among all the edges not in T, that are incident on a vertex in T and
do not form a circuit when added to T, Select one of minimal cost and
add it to T.
 3) The process terminates after we have added (n – 1) edges
where n = |V(G)|.
Construction of Spanning Tree
 DFS(Depth First Search)
It uses Stack.
The principle of the algorithm is quite simple: to go
forward (in depth) while there is such possibility, otherwise
to backtrack.
 BFS(Breadth First Search)
It uses Queue.
Breadth-first search starts with given node
Then visits nodes adjacent in some specified order
(e.g.,alphabetical)
Planar Graphs
 A graph or a multi graph that can be drawn in a plane or on a sphere
so that its edges do not cross is called a planar graph.
 Ex : A complete graph on 4 vertices K4 is a planar graph.
 Ex : Tree is a planar graph.
 Map, Connected map : A particular planar representation of a finite
planer multi graph is called a map. We say that the map is connected if
the under lying multi graph is connected.
 Region : A given map (planar graph) divide the plane into connected
areas called regions
 Degree of a region : The boundary of each region of a map consists
of a sequence of edges forming a closed path. The degree of region ‘r’
denoted by deg (r) is the length of the closed path bordering r .
Sum of degrees of regions theorem
 If G is a planar graph with k regions, then the sum of the degrees of
the regions of G is equal to twice the number of edges in G.
i.e.,  deg (ri) = 2. E .
k
 Cor.1 In a planar
i=1
graph G, if the degree of each region is k then
k.R  = 2 .E
 Cor.2 In a planar graph G, if the degree of each region is  k , then
k.R   2 .E
 In particular, If G is a simple connected planar graph ( A planar graph
with no loops and no parallel edges, and degree of each region is  3),
then
3. R   2 . E 
Euler’s formula
 Question: State and prove Euler’s formula for planar graphs.
 Statement: If G is a connected planar graph, then
 V –  E + R  = 2.
Proof: …..by Mathematical Induction
 Theorem: If G is a simple connected planar graph with  E > 1 then,
(a)  E  {3. V – 6}.
(b) There exists at least one vertex v of G such that deg(v)  5
 Theorem: If G is a simple connected planar graph with  v > 3 then,
 R  {2. V – 4}.
Polyhedral graph
 Polyhedral Graph: A connected planar graph is said to be
polyhedral if degree of each region is  3 and deg(v)  3
for all v  G.
i.e., 3. R   2 . E  and 3. V   2 . E .
 For any polyhedral graph
 a) V   (2 + R  )
 2
 b) R   (2 + V  )
 2
 c) (3. R - 6)  E 
Euler Path and Circuit
 Euler Path: An Euler path in a multigraph is a path that includes
each edge of the multi graph exactly once and intersects each vertex
of the multi graph at least once.
 An Euler circuit is an Euler path whose end points are identical.
 A multigraph is traversable if it has Euler path.
 A non directed multi graph has an Euler path iff it is connected and
has zero or exactly two vertices of odd degree.
 Any finite connected graph with exactly two odd vertices is
traversable(Euler path exists). A traversable trail may begin at either
odd vertex and will end at other odd vertex.
 A connected multi graph has an Euler circuit if and only if all of its
vertices are of even degree.
Hamiltonian Graph
 Hamiltonian Graph: A Hamiltonian Graph is a graph with a closed
path that includes every vertex exactly once. Such a path is a cycle
and is called a Hamiltonian cycle.
 An Eulerian circuit uses every edge exactly once but may repeat
vertices , while a Hamiltonian cycle uses each vertex exactly once
(except for the first and last) but may skip edges.
Kurtowski Theorem
 A graph G is not planar iff G contains a sub graph homomorphic to
K3, 3 or K5 .
 Ex. A planar graph contains 25 vertices and 60 edges then find the
number of regions in the graph .
 Ex. What is the maximum number of edges possible in a planar graph
with eight vertices ?.
 Ex. What is the minimum number of vertices necessary for a graph
with 11 edges to be a simple planar graph?.
 Ex. Suppose that a connected planar graph has 20 vertices, each of
degree 3. In to how many regions does a representation of this planar
graph split the plane ?
Examples
 Ex. Let G is a connected planar graph with 35 regions and degree of
each region is 6. Find the number of vertices in G ?.
 Ex. Suppose G is a polyhedral graph with 12 vertices and 30 edges
prove that degree of each region is 3.
 Ex. Show that there does not exist a polyhedral graph with exactly
seven edges.
 Ex. Show that there does not exist a polyhedral graph with exactly 30
edges and 11 regions.
 Theorem: Prove that a complete graph Kn is planar iff n  4.
 Theorem: Prove that a complete Bipartite graph Km, n is planar
iff m  2 or n  2.
Chromatic number
 Vertex coloring: A coloring of a simple graph is the assignment of
color to each vertex of the graph so that no two adjacent vertices are
assigned the same color.
 Chromatic Number: The minimum number of colors needed to
paint a graph G is called the chromatic number of G , denoted by
(G)
 Adjacent Regions: In a planar graph two regions are adjacent if they
share a common vertex.
 Map coloring: An assignment of colors to the regions of a map such
that adjacent regions have different colors.
 A map ‘M’ is n – colorable if there exists a coloring of M which uses n
colors.
 A planar graph is 5 – colorable
Four color Theorem
 Four color Theorem: If the regions of a planar graph are colored so
that adjacent regions have different colors, then no more than 4
colors are required.
i.e., (G)  4.
 Ex. Prove that the chromatic number of a complete graph Kn is n.
 Ex. Prove that the chromatic number of a complete Bipartite graph
Km, n is 2.
 Ex. Prove that the chromatic number of cyclic graph Cn is 2 if n is
even and 3 if n is odd.
 Ex. If every cycle of G has even length then show that its chromatic
number is 2.
 Ex. Prove that the chromatic number of a tree on n vertices is 2.

You might also like