Download presentation

Presentation is loading. Please wait.

Published byEstefany Robbins Modified over 2 years ago

1
Tutorial 5 of CSCI2110 Eulerian Path & Hamiltonian Cycle Tutor: Zhou Hong ( 周宏 ) hzhou@cse.cuhk.edu.hk

2
About Me Name: Zhou Hong ( 周宏 ) Office: SHB117 Office Hour: Friday 10:00 am – 12:00 noon or by appointment Topics Responsibility: Graph Theory

3
Outline Eulerian Path Hamiltonian Cycle Stable Matching

4
Eulerian Path & Eulerian Cycle Eulerian Path: a path that visits every edge exactly once Eulerian Cycle: a cycle that visits every edge exactly once

5
Exercise: T/F Questions A Simple Path is a Path A Simple Cycle is a Cycle A Simple Cycle is a Simple Path A Path is a Cycle A Eulerian Cycle is a Eulerian Path

6
Euler’s theorem: A connected graph has an Eulerian cycle if and only if every vertex is of even degree. Eulerian Cycle Necessary Condition for Eulerian Cycle: If a connected graph G has an Eulerian cycle, then every vertex in G is of even degree. Example: An Eulerian Cycle: Check that every vertex is of even degree

7
Euler’s theorem: A connected graph has an Eulerian cycle if and only if every vertex is of even degree. Eulerian Cycle

8
Euler’s theorem: A connected graph has an Eulerian path (but not cycle) if and only if there are two vertices with odd degrees. Necessary Condition for Eulerian Path: If a connected graph G has an Eulerian path (but not cycle), then exactly two vertices in G are of odd degrees. Example: An Eulerian Path: Check that only are of odd degrees. Eulerian Path

9
Euler’s theorem: A connected graph has an Eulerian path (but not cycle) if and only if there are two vertices with odd degrees. Eulerian Path

10
Euler’s theorem: A connected graph has an Eulerian path (but not cycle) if and only if there are two vertices with odd degrees. Sufficient Condition for Eulerian Path: In a connected graph G, if there are exactly two vertices have odd degrees, then G has an Eulerian Path (but not cycle). Exercise: Prove the above Sufficient Condition. (Hint: reduce to Eulerian Cycle) Eulerian Path

11
Proof of Sufficient Condition: Let the two odd degree vertices in G be u,v. Add an edge e between u,v to form a new connected graph G’. Now, every vertex in G’ has even degree. We have reduced to Eulerian cycle problem, therefore, G’ has an Eulerian cycle. Remove e from the cycle, we get a Eulerian path of G. (u,v are starting and ending points of the path) G u v G’ Eulerian Path

12
Hamiltonian Path & Hamiltonian Cycle Hamiltonian Path: a path that visits every vertex exactly once. Hamiltonian Cycle: a cycle that visits every vertex exactly once (except for the vertex that is both the start and end). A Hamiltonian Cycle in a dodecahedron

13
Hamiltonian Path in Homework 3 Tips: the following example is similar to Q3 of HW3, but not the same.

14
Hamiltonian Cycle in Undirected Graph Do we need to specify that G is connected? NO Exercise: Prove that minimum degree of G is at least n/2 implies G is connected Key Observation: Any pair of vertices share at least one common neighbor.

15
Proof Idea Start with a longest simple path P=v 1 v 2...v k. We can find a simple cycle C among v 1 to v k in graph G. If k < n, since G is connected, there must exists a vertex adjacent to some vertex in the cycle C. – Which implies we can get a longer simple path through C. vkvk v1v1 P…P… v2v2 v3v3 v4v4 v k-1 v k-2 v

16
Find a Simple Cycle vkvk v1v1 P…P… v2v2 v k-1 v k-2 vivi v i+1 Now, what we need to do is just finding a cycle among v 1 to v k. But how? If there exists a pair of vertices v i and v i+1, such that v i+1 is adjacent to v 1 and v i is adjacent to v k, then we can find a cycle C = v i+1 v i+2 …v k v i v i-1 …v 2 v 1 v i+1.

17
Existence of Such Vertex Pair v i and v i+1 vkvk v1v1 P…P… v2v2 v3v3 v4v4 v k-1 v k-2

18
Stable Matching

19
Morning: boys propose to their favorite girl on list. If a boy has an empty list already, he stays home and does his CSC2110 homework. Afternoon: girls accept their favorite suitor and reject the rest (possibly breaking up with her current boyfriend) Evening: boys who got rejected write off the top girl from their lists The Marrying Procedure This procedure is then repeated until all boys propose to a different girl

20
Boys Optimal & Girls Pessimal Algorithm All boys get the best partner simultaneously! All girls get the worst partner simultaneously! Can a girl do better by lying? That is, among all possible stable matching, boys get the best possible partners simultaneously. YES!

21
Girls with True Preference (Day 1) Boys A:213 B:123 C:231 1:ABC 2:BAC 3:CBA Girls

22
Girls with True Preference (Day 2) Boys A:213 B:123 C:231 1:ABC 2:BAC 3:CBA Girls OKAY, marriage day! Girl 2 gets her second best choice

23
Girl 2 Tells a Lie (Day 1) Boys A:213 B:123 C:231 1:ABC 2:BCA 3:CBA Girls

24
Girl 2 Tells a Lie (Day 2) Boys A:213 B:123 C:231 1:ABC 2:BCA 3:CBA Girls

25
Girl 2 Tells a Lie (Day 3) Boys A:213 B:123 C:231 1:ABC 2:BCA 3:CBA Girls

26
Girl 2 Tells a Lie (Day 4) Boys A:213 B:123 C:231 1:ABC 2:BCA 3:CBA Girls OKAY, marriage day! Girl 2 gets her best choice

27
Thank You! Q & A ?

Similar presentations

OK

1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.

1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on formal education chico Download ppt on turbo generator aircraft Ppt on motivational techniques Ppt on models of atoms Ppt on insulator manufacturing process Ppt on carl friedrich gauss contributions Ppt online examination project Ppt on film industry bollywood movies Free download ppt on india of my dreams Ppt on noun in hindi language