Lecture 8 - EC and HC

Download Report

Transcript Lecture 8 - EC and HC

MCA 202: Discrete Mathematics

under construction

Instructor Neelima Gupta [email protected]

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: V 1 V 2 V 3 V 4 V 5 . . . . . . . . .

V q V p By removing an edge v p -v q for v 1 to v q path.

, the claim holds Thanks: Shammi-37 and Shivangi-38 (MCA 202)

Now adding that edge v p claim still follows as v odd degrees.

1 to the initial path, the and v p are vertices with 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 will end with another odd vertex.

Vertices:Degrees Hence, it has an euler path.

V 1 V 2 V 8 V 3 V 4 V 7 V 5 V 6 V 1 V 2 V 3 : 1, Odd : 2, Even : 2, Even V 4 V 5 : 2, Even : 2, Even V 6 V 4 V 4 V 7 V 8 : 2, Even : 3, Odd : 4, Even : 2, Even : 2, Even V 2 : 3, Odd Thanks: Shammi-37 and Shivangi-38 (MCA 202)

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 :

v 1 v 2 v 3 v j-1 v j Thanks: Sonam 39 and Stuti 40 (MCA 202) v p

v 1 v 2 v x v k-1 v k v j-1 v j (a) Thanks: Sonam 39 and Stuti 40 (MCA 202) v p

v 1 v 2 v x v k-1 v k v j-1 v j (b) Thanks: Sonam 39 and Stuti 40 (MCA 202) v p

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 B D 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 Thanks: Sonam 39 and Stuti 40 (MCA 202) C

A B Not A Planar Graph B C A C E D E There is no other way to connect edge AD and EC Thanks: Sonam 39 and Stuti 40 (MCA 202) D

Region : 3

A

1 2

C 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) D B

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 G’ Removed edge (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)