0% found this document useful (0 votes)
61 views54 pages

DSGTChap 6 Graph Theory

The document discusses different types of graphs and graph theory concepts like paths, circuits, trees, isomorphic graphs and more. It defines key graph terms and provides examples to explain graph theory theorems and properties.

Uploaded by

abcyz141608
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)
61 views54 pages

DSGTChap 6 Graph Theory

The document discusses different types of graphs and graph theory concepts like paths, circuits, trees, isomorphic graphs and more. It defines key graph terms and provides examples to explain graph theory theorems and properties.

Uploaded by

abcyz141608
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/ 54

CHAPTER 6

GRAPH THEORY
B Y P R O F. M I T R A K S H I PAT I L
GRAPH

• A graph G is a triple G=(V,E, γ)


where V –finite set of vertices
E- finite set called edges of G &
γ- a function that assigns to each edge a subset {v,w} where v,w are the
vertices.
If e is an edge & γ={v,w}, we say that e is an edge between v & w.

EX. Let V={1,2,3,4} & E={e1,e2,e3,e4,e5}. Let g be defined by,


γ(e1)= γ(e5)={1,2}
γ(e2)={4,3} γ(e4)={2,4} γ(e3)={1,3}
Then, G=(V,E, γ) is a graph-
GRAPH

• Vertex is also called node, junction or point


• Edge-line, element, arc
• Degree-The degree of a vertex V of a graph G (denoted by deg (V)) is the number of
edges incident with the vertex V.
• Loop-A graph may contain an edge from a vertex to itself.
Such an edge is called a Loop.(degree is 2).
• Isolated vertex- A vertex with degree 0.
• A pair of vertices that determine an edge
are adjacent vertices.
Degree of A-2 B-4 c-3
F-isolated vertex, A & B-adjacent, A & D-not adjacent
GRAPH
• Path- A path π in a graph is a sequence π:V1,V2,V3…..Vk of vertices, each adjacent to
next & a choice of an edge between each Vi & Vi+1 so that no edge is chosen more
than once.
• E.g. Paths in fig.
π1=D,E,B,C
π2 =A,B,A
π3 =A,B,E,D,D
• Number of edges in a path is called length of a path.
• A circuit is a path that begins & ends with same vertex.
TYPES OF GRAPH

• Null Graph- A null graph has no edges. The null graph of n vertices is denoted by Nn.

• Simple Graph- A graph is called simple graph/strict graph if the graph is undirected and
does not contain any loops or multiple edges.
• Multi-Graph- If in a graph multiple edges between the same set of vertices are allowed, it
is called Multigraph. In other words, it is a graph having at least one loop or multiple
edges.

• Connected and disconnected graph- A graph is called connected, if there is a path from
any vertex to any other vertex in the graph. A graph is called disconnected if there
is no path between any two of its vertices.
• Discrete Graph- A graph Dn with n vertices & no edges is called discrete graph on n
vertices.

• Complete graph-For each integer n≥1, let Kn denote graph with vertices
{V1,V2,V3…Vn} with an edge {Vi,Vj} for every i & j. In other words, every vertex in Kn is
connected to every other vertex.
• Linear Graph-For each integer n ≥1, let Ln denote graph with vertices {V1,V2,V3…Vn}
with an edge {Vi,Vi+1} for 1≤i≤n .

• Directed graph- A directed graph or digraph is an ordered pair (V,E) where V is non-
empty set of elts called vertices & E is set of ordered pair elts called directed edges.
• Labelled or Weighted graph- A graph G is called a labelled graph if its edges and/or
vertices are assigned data of one kind or another.
• G is called weighted graph if each edge ‘e’ of G is assigned a non-negative number called
the weight or length of V .
REPRESENTATION OF GRAPHS
• There are mainly two ways to represent a graph −
• Adjacency Matrix
• Adjacency List
1. Adjacency Matrix of an- Undirected Graph
• Adjacency List of an undirected graph-
SUBGRAPH

• Let G=(V,E, γ)is a graph.


• Choose a subset Ei of edges in E & a subset V1 of vertices in V so that V1 contains all
the endpoints of edges in E1. Then H=(V1,E1, γ1)is also a graph, where γ1 is γ restricted
to edges in E1. Such a graph H is called a Subgraph of E1.
SPANNING SUBGRAPH

• A subgraph is said to be spanning subgraph if it contains all the vertices of G.


• In above fig, b is spanning subgraph.
HANDSHAKING LEMMA

• Consider a graph G with e number of edges & n number of vertices. Since each edge
contribute 2 degrees, the sum of degrees of all vertices in G is twice the number of
edges in G.

• This is called Handshaking lemma. It is so named, because it implies that if several


people shake hands, the total number of hands shaken must be even.
EXAMPLE

• How many nodes are necessary to construct a graph with exactly 6 edges in which each
node is of degree 2?
• Soln-
Suppose, there are n vertices, in graph with 6 edges.
Also, given degree of each vertex is 2.
So, by Handshaking lemma,

=2*6
d(V1)+ d(V2)+ d(V3)+… d(Vn)=2*6
2+2+….+2 =12
2n =12 So, n=6 nodes
EULAR PATHS & CIRCUITS

A Path in a graph is called an Eular path if it includes every edge exactly once.

An Eular circuit is an Eular path that is a circuit.

• In fig a, Eular path π=E,D,B,A,C,D


No Eular circuit.

• In fig b, Eular circuit π=5,3,2,1,3,4,5


THEOREMS
1. a. If a graph G has a vertex of odd degree, there can be no Eular ckt in G.
b. If G is a connected graph & every vertex has even degree, then there is an Eular
ckt in G.
2. a. If a graph G has more than 2 vertices of odd degree, then there can be no Eular path in
G.
b. If G is connected graph, and has exactly 2 vertices of odd degree, then there is an Eular
path in G. Any Eu. Path in G must begin at 1 vertex of odd degree & end at the other.

• Example-In fig, every ver. has even degree.


So by theorem 1b, there must be Eu. Ckt.
π=1,6,7,6,4,3,5,7,3,2,4,1,2,1
• Example2-
• Find Eular path and Circuit for the
following Graph.

Solution- 2 vertices B & C have odd degree 3. So, no Eu ckt by thm 1a.

But Eu path by theorem 2b.

π=B,A,E,D,C,B,D,A,C
Example3-
Find Eular path & circuit for the foll. Graph.
1. 4 vertices of odd degree, so there is NO Eular ckt & path by
thm 1a,1b & 2b.
HAMILTONIAN PATHS & CIRCUITS
• A Hamiltonian path is a path that contains each vertex exactly once.
• A Hamiltonian ckt is a ckt that contains each vertex exactly once except for the first
vertex which is also the last.

• Example- H. path- a,b,c,d,e.


No H. ckt.
THEOREMS
1. G has a H. ckt if for any 2 vertices u & v of G, that are not adjacent, the degree of u plus
degree of v is greater than or equal to no. of vertices.
2. G has a H. ckt if each vertex has degree greater than or equal to n/2.
3. Let the no. of edges of G be m. Then G has a H. ckt if m>=½ (n2-3n+6).(‘n’ is the no. of
vertices.)
4. There is always a H. path in a directed complete graph.
Example 1-
Consider, ver. 1 & 7 which are not adjacent.
Degree of 1-2 7-3
So, Degree of 1 +degree of 7> no. of vertices
2+3>7
5 7
There is no H. ckt.
But, H.path= 3,1,2,4,6,7,5
• Example 2-

In fig. no. of vertices=5


Each vertex in graph has degree greater than or equal to 5/2.
So, there is a H. ckt.
π=1,3,5,4,2,1
H. path= π=1,3,5,4,2.
• Example3-Determine whether the foll. Graph has H. path & circuit or not.
• Solution-
Each vertex in graph has degree 3 which is not greater than 4,
where 4 is the number of vertices divided by 2.
So, there is no H. circuit. But, there is H.path.
π1= a,g,f,h,c,b,d,e
π2= a,g,f,e,d,b,c,h
• Example-

Find H. path & circuit for the foll. Graph.


a. Not a connected graph, so No H. path & circuit .
b. No H. path & circuit.
TRAVELLING SALESPERSON PROBLEM
• Statement-
A salesperson is required to visit a no. of cities during a trip. Given the distances between
the cities, in what order should he travel so as to visit every city exactly once & return
home with minimum distance travelled?

There are several H. ckts starting from a.


1. a b e d a with weight 22
2. a b e c d a with weight 24
3. a c e b d a with weight 26 &so on.

Min. H ckt is a b d e c a =2+9+4+1+3=19


NEAREST NEIGHBOUR METHOD
• In this method, we start the H.ckt with any arbitrary vertex & find the vertex nearest to
it.
• Continuing this way & coming back to starting vertex by travelling through all the
vertices exactly once, we get Hamiltonian circuit.

• Method-
1. Start with an arbitrary vertex & find the vertex to closest to starting vertex to form
an initial path of one edge.
2. Let, x’ denote latest vertex added to the path along all vertices that are not in path,
pick one that is closest to z & add to the path the edge connecting x & this vertex.
Repeat step 2 until all the vertices in G are included in the path.
3. Form a ckt by adding the edge connecting starting vertex & the last vertex added.
• Example- Use Nearest Neighbor method to find out H. ckt for graph shown in fig.
Starting vertex a.
• Solution-
1. There are 4 adjacent vertices to ‘a’- b,c,d,e
But, near. Neigh. is c.
So, H. path={a.c}

2. 3 vertices adjacent to c-b,d,e.


Near. Neigh. Is b.
H. path={a,c,b}
3. H. path= {a,c,b,d}

4. H.path= {a,c,b,d,e}

5. Since, all vertices are traversed to complete H. ckt,


Hamiltonian path= {a,c,b,d,e,a}
Weight of H. ckt=18
ISOMORPHIC GRAPH
• 2 Graphs G1(V1,E1) & G’(V’,E’) are said to be isomorphic to each other if there is a one-
to-one correspondence between their vertices & between their edges such that the
incidence relationship is preserved.
• Means, suppose that edge e is incident on V1 & V2 of G1, then corresponding edge e’ in
G’ must be included in V1’ & V2’ that corresponds to V1 & V2.
• Isomorphic Graphs are denoted by G1≅G2.

• In fig, G1≅G2.
• One-to-one correspondence between both vertices are-1-a,2-b,4-d, 3-c
• Two isomorphic Graphs must have-

1. Same no. of vertices


2. Same no. of edges
3. An equal no. of vertices, with a given degree.
Example2- Determine whether fol. Graphs are isomorphic or not.

G1- x-degree-3, 2 adjacent u & v & one vertex of degree 2.


G2- y-degree-3, only 1 adjacent vertex w & 2 vertices of degree 2.
Adjacency is not preserved.
So, G1 G2
Example3- Determine whether fol. Graphs are isomorphic or not.

Both contain 8 ver. & 10 edges.


No. of vertices of degree 2 in both are 4.
Also, No. of vertices of degree 3 in both graphs are 4.
For adjacency, consider ver. 1 & 3 in G1.They are adjacent to 2 vertices of degree 3. & 1 vertex
of degree 2.
But in G2, there is no any vertex of degree 3 which is adjacent to 2 vertex of degree 3 &
1 vertex of degree 2.
Therefore, Adjacency is not preserved. So, G1 & G2 are not isomorphic.
Example4- Determine whether foll. Graphs are isomorphic or not.

Solution- G1 & G2 have


same no. of vertices =4
same no. of edges=6
Each vertex is having degree 3.Adjacency is also preserved.
One-to-one correspondence is given by the function , where
v={a,b,c,d} v*={a’,b’,c’,d’}
So, f={(a.a’),(b,b’),(c,c’),(d,d’)}
Therefore, G1 & G2 are isomorphic.
Example5- Determine whether following Graphs are isomorphic or not.
• No. of ver-6
• Edges-9
• Correspondence={(u1,v5),(u2,v2) ,(u6,v1) ,(u4,v6) ,(u5,v4) ,(u3,v3)}
• So, the graphs are isomorphic.
PLANAR GRAPHS
• A graph is said to be planar if it can be drawn on a plane in such a way that no edges
cross one another, except of course at common vertices.

• Suppose, we draw a planar graph on plane & take a sharp knife to cut along edges ,then
the plane will be divided into pieces that are called the regions of the graph.
• A region of planar graph is defined to be an area of the plane that is bounded by edges &
is not further divided into subareas.
• Example-
• Note that cutting along edge a does not divide region 1 further.
• Also, edges b, c, d-no further regions.

• A region is said to be finite if its area is finite & is said to be infinite if its area is infinite.
• A planar graph-exactly 1 infinite region.
• Example2 : Consider the graph shown in Fig. Determine the number of regions, finite and
infinite regions.

• Solution: There are five regions in the above graph, i.e. r1,r2,r3,r4,r5.
There are four finite regions in the graph, i.e., r2,r3,r4,r5.
There is only one finite region, i.e., r1
THEOREM 1
For any connected planar graph,
1.
v-e+r=2 …………..eqn.1
Where v,e,r- no. of vertices,edges & regions of the graph.

Example-

Eqn. 1 is known as Eular’s formula for planar graphs.


THEOREM 2

2. If G(V,E) is a simple connected planar graph then,


e ≤ 3v-6

Where e- total no. of edges


v- total no. of vertices in graph G.
Example- Determine whether foll. Graph is planar.

• No. of ver.=6
• Edges=9
• Regions=7
So, according to the Eular’s formula,
v-e+r=2
6-9+7=2
4 ≠ 2. So, the graph is not planar. Also, there are crossing edges.
CUT VERTEX

• 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.
• Note − Removing a cut vertex may render a graph disconnected.
• A connected graph 'G' may have at most (n–2) cut vertices.

• Example
• In the following graph, vertices 'e' and 'c' are
the cut vertices.
• By removing 'e' or 'c', the graph will become a disconnected graph.

• Without ‘e', there is no path between vertex 'c' and vertex 'h' and many other. Hence
it is a disconnected graph with cut vertex as 'e'. Similarly, 'c' is also a cut vertex for
the above graph.
CUT EDGE

• 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 into two or more graphs, then that edge is called
a Cut Edge.

• Example
In the following graph, the cut edge is (c, e).
• By removing the edge (c, e) from the graph, it becomes a disconnected graph.

• In the above graph, removing the edge (c, e) breaks the graph into two which is nothing
but a disconnected graph.
• Hence, the edge (c, e) is a cut edge of the graph.
• Important Points-
• 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.
CUT SET

• 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.
• Example
• Take a look at the following graph.
• Its cut set is E1 = {e1, e3, e5, e8}.
• After removing the cut set E1 from the graph, it would appear as follows −

• Similarly there are other cut sets that can disconnect the graph −

• E3 = {e9} – Smallest cut set of the graph.


• E4 = {e3, e4, e5}

You might also like