Lecture 8 - EC and HC

advertisement
MCA 202: Discrete Mathematics
under construction
Instructor
Neelima Gupta
ngupta@cs.du.ac.in
Table of Contents
• Eulerain Path and Circuits
• Hamiltonian Path and Circuits
• Planar Graphs
Eulerian Paths & Circuits
Given an undirected graph G, a path is
called an eulerian path if it spans all the
vertices and scan each edge exactly once.
Also, in an undirected graph G, a circuit is
called an eulerian circuit if it spans all the
vertices and scan each edge exactly once.
Thanks: Shammi-37 and Shivangi-38
(MCA 202)
Examples:
Thanks: Shammi-37 and Shivangi-38
(MCA 202)
Theorem:
An undirected graph possesses an eulerian
path iff all the vertices are of even degree
except possibly for two vertices.
Claim:
A graph has an euler path (or circuit) if
the number of odd degree vertices in
the graph is two (or zero).
Thanks: Shammi-37 and Shivangi-38
(MCA 202)
Proving by Induction:
If euler path have only 1 edge, |EP| = 1
Similarly, claim is true for (e - 1) edges,
|EP| = e – 1
Now, consider a path:
V1
V2
V3
V4
V5
.........
Vq
Vp
By removing an edge vp-vq , the claim holds
for v1 to vq path.
Thanks: Shammi-37 and Shivangi-38
(MCA 202)
Now adding that edge vp to the initial path, the
claim still follows as v1 and vp are vertices with
odd degrees.
Hence, proved.
Thanks: Shammi-37 and Shivangi-38
(MCA 202)
Converse: If the number of odd degree
vertices in the graph is two (or zero), the
graph has an euler path (or circuit).
Start with an odd degree vertex, and we
Vertices:Degrees
will end with another odd vertex.
V : 1, Odd
V : 2, Even
Hence, it has an euler path.
1
2
V1
V4
V2
V6
V5
V3
V8
V7
Thanks: Shammi-37 and Shivangi-38
(MCA 202)
V3 :
V4 :
V5 :
V6 :
V4 :
V4 :
V7 :
V8 :
V2 :
2, Even
2, Even
2, Even
2, Even
3, Odd
4, Even
2, Even
2, Even
3, Odd
Hamiltonian Path/ Circuit
• It is a path/circuit that passes through each of the vertices in
graph exactly once.
• This is more constraint compare to Euler path.
• There is no polynomial time solution for Hamiltonian path.
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Hamiltonian path
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Theorem:
If in a Graph G, the sum of the degrees for each pair
of vertices in G is n-1 or larger, where n is the number
of vertices in the graph, then there exists a
Hamiltonian path in G.
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Figures for Proof :
v1
v2
v3
vj-1
vj
Thanks: Sonam 39 and Stuti 40 (MCA 202)
vp
vx
v1
v2
vk-1 v k
vj-1
vj
(a)
Thanks: Sonam 39 and Stuti 40 (MCA 202)
vp
vx
v1
v2
vk-1 v k
vj-1
vj
(b)
Thanks: Sonam 39 and Stuti 40 (MCA 202)
vp
Planar Graph
Thanks: Sonam 39 and Stuti 40 (MCA 202)
PLANAR GRAPHS
•A graph is said to be planar graph if it can be drawn on a 2-D
plane in such a way that no edges cross one other
Example:-
A
D
B
C
Thanks: Sonam 39 and Stuti 40 (MCA 202)
In a planar graph, edge is only a concept of connectivity.
Edge from vertex A to vertex C can also be drawn as follow:-
A
B
A
B
D
C
D
C
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Not A Planar Graph
B
B
A
E
C
D
A
C
E
D
There is no other way to connect edge AD and EC
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Region :
3
A
B
1
2
C
D
Edges belonging to :
Region 1 – AC,CB,AB
Region 2 – CB,CD,AB
Region 3 – AB,BD,DA
Region 4 – CD,DA,AC
Thanks: Sonam 39 and Stuti 40 (MCA 202)
4
Theorem:
For any connected planar graph,
v-e+r=2
where v , e and r are the number of vertices, edges,
and regions of the graph, respectively
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Proof :
By induction on number of edges.
For e = 1,
Number of vertices (v) = 2
Number of region(r) = 1 (outside)
Putting in formula,
v – e + r = 2 - 1+ 1
=2
Hence , it holds for e=1.
We’ll assume it holds for graph with n-1 edges.
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Suppose, we have connected graph G with e edges.
We’ll remove one edge.
CASE 1: If removing an edge leads to two
disconnected graph
Removed edge
G’
(e2 , v2 , r2)
G’’
(e1 , v1 , r1)
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Since, Both G' and G'' have e < n-1.
Therefore, using induction hypothesis,
v1 – e1 + r1 = 2 and v2 – e2+ r2 = 2
Adding above two equations,
 v1 – e1 + r1 + v2 – e2 + r2 =2 + 2
 (v1 + v2) - (e1 + e2)+ r1 + r2 = 4
 v - (e -1) + r + 1 = 4(one extra region after removing one edge)
v–e+r+2=4
v–e+r=2
Hence, it holds for all graph with n edges.
Thanks: Sonam 39 and Stuti 40 (MCA 202)
CASE 2: If removing an edge leads doesn’t lead to
disconnected graph
Removed edge
G’
(e’ , v’ , r’)
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Since, G’ have e < n-1.
Therefore,
v'– e'+ r' = 2
For graph G',
v' = v
e' = e -1
r' = r – 1 (subtracting region created by removed edge)
 v' + e' + r' =2
v–(e–1)+r–1=2
v–e+r=2
Hence, it holds for all graph with n edges.
Thanks: Sonam 39 and Stuti 40 (MCA 202)
Download