230 likes | 304 Views
Marriage, Trees and Connectivity. CSC2110 Tutorial 4 Jerry Le jlle@cse.cuhk.edu.hk Rm120, SHB Office hour: Thu 3pm-5:30pm Oct 11 2007. Outline. Quick Review Q & A (questions from classwork2). Quick Review. Marriage
E N D
Marriage, Trees and Connectivity CSC2110 Tutorial 4 Jerry Le jlle@cse.cuhk.edu.hk Rm120, SHB Office hour: Thu 3pm-5:30pm Oct 11 2007
Outline • Quick Review • Q & A (questions from classwork2)
Quick Review • Marriage - Stable Marriage (Matching) Problem, “Unstable pair”, “Marriage Procedure” - Bipartite Marriage (Matching) Problem, “Hall’s Theorem” - Applications, Student & Hospitals, Latin Square, Tiling Chessboard with dominos... • Trees - Definition and Properties, different equivalent ways to define tree, cut edge - Spanning tree - Directed graph, Directed spanning tree, Acyclic directed graph - Strongly connected graph, Graph Orientation, Robin’s Theorem - Graph connectivity, k-edge connected, k-path connected
True of False 1. We can always find a stable matching for any Stable Roommate Problem. - False, if there is triangular relationship 2. If we only allow boys to share room with girls, we can always find a stable matching for any Stable Roommate Problem. - True, equivalent to stable marriage 3. If we only allow boys to share room with boys, we can always find a stable matching for any Stable Roommate Problem. - False, equivalent to the general stable roommate problem 4. We can always find a perfect matching for the bipartite matching problem. - False, consider Hall’s Theorem
Is the following graph a bipartite graph? Yes, put red vertices on one side and blue vertices on the other. A bipartite graph has a vertices on one side and b vertices on the other, and have m edges. Then the number of edges in the bipartite matching is upper bounded by min{a,m,b} - True. A bipartite graph has a vertices on the L side and b vertices on the R side, and have m edges. We know that for every we have , then the number of edges in the bipartite matching is at most a. - True. Hall’s Theorem
True or False (Long Question Q2) When we apply the “Marriage Procedure”, if a girl G rejects a boy B, then (G,B) can NOT be a valid pair in the stable matching. - True. Why? Proof by contradiction and induction. Recall the “Marriage Procedure”, in each iteration: Step 1. Every unmarried boy proposes to his favorite girl Step 2. Every girl chooses her favorite boy (among those who proposing to her) to marry. Step 3. The boy who get rejected remove his favorite girl on the list, and then go to Step 1.
True or False (Long Question Q2) When we apply the “Marriage Procedure”, if a girl G rejects a boy B, then (G,B) can NOT be a valid pair in the stable matching. - True. Why? Proof by contradiction and induction. On the first day (iteration)... B* We know G rejects B G X B There is B* who G likes better G is B*’s favorite girl (G,B*) will be an unstable pair if we marry (G,B) in our matching, contradiction!
True or False (Long Question Q2) When we apply the “Marriage Procedure”, if a girl G rejects a boy B, then (G,B) can NOT be a valid pair in the stable matching. - True. Why? Proof by contradiction and induction. Suppose the claim is true for the first k days on the k+1 day... We know G rejects B B X G There is B* who G likes better B* I can not be with girls that are higher in my list anyway... G is B*’s best choice, why? (G,B*) will be an unstable pair if we marry (G,B) in our matching, contradiction!
True or False (Long Question Q2) When we apply the “Marriage Procedure”, we marry each boy to his best possible wife, and marry each girl to her worst possible husband... - True. Why? For the boys, the first girl that does not reject him is his best possible valid wife. How about the girls? Suppose B is not G’s worst In some other stable matching, G can marry B*, who is G’s worst husband G is B’s best wife G B B* Results by the Marriage Procedure then (G,B) will be an unstable pair, contradiction!
How to allocate TAs into universities... (Long Question Q3) • We want to allocate TAs into different universities • Each TA has a preference list among the universities • Each university has a preference list among the TAs • Each university may have multiple positions 1) What an unstable pair should mean in this case? case a: Suppose this is our matching CUHK Jerry but Jerry likes HKUST better, and HKUST likes Jerry better than Tom HKUST Tom, Isaac
How to allocate TAs into universities... (Long Question Q3) • We want to allocate some TAs into different universities • Each TA has a preference list among the universities • Each university has a preference list among the TAs • Each university may have multiple positions 1) What an unstable pair should mean in this case? case b: Suppose this is our matching Darek CUHK Jerry Jerry is not assigned to any university, and HKUST likes Jerry better than Isaac HKUST Tom, Isaac
How to allocate TAs into universities... (Long Question Q3) • We want to allocate some TAs into different universities • Each TA has a preference list among the hospitals • Each university has a preference list among the TAs • Each university may have multiple positions 1) What an unstable pair should mean in this case? case c: Suppose this is our matching Darek CUHK Jerry HKUST (still has unfilled position) Jerry is assigned to CUHK, but Jerry likes HKUST better than CUHK, and HKUST still has unfilled quota. Tom, Isaac
How to allocate TAs into universities... (Long Question Q3) • We want to allocate some professors into different universities • Each TA has a preference list among the TAs • Each university has a preference list among the TAs • Each university may have multiple positions 2) How to apply the “Marriage Procedure” in this case? The idea: replace one university with many girls who have the same preference list.
Latin Squares (n by n) (Long Question Q4) • Each row contains all the n numbers • Each column contains all the n numbers Suppose you are given a 5 by 3 Latin rectangle... The idea: construct a bipartite graph like this... How to fill the next row?
Latin Squares (n by n) (Long Question Q4) • Each row contains all the n numbers • Each column contains all the n numbers Suppose you are given a 5 by 3 Latin rectangle... Connect number i and column j if column j does not have number i How to fill the next row?
Latin Squares (n by n) (Long Question Q4) • Each row contains all the n numbers • Each column contains all the n numbers Suppose you are given a 5 by 3 Latin rectangle... We have a 2-regular bipartite graph, why? How to fill the next row?
Latin Squares (n by n) (Long Question Q4) • Each row contains all the n numbers • Each column contains all the n numbers Suppose you are given a 5 by 3 Latin rectangle... Find a perfect matching 1 5 3 4 2 How to fill the next row?
Latin Squares (n by n) (Long Question Q4) • Each row contains all the n numbers • Each column contains all the n numbers Suppose you are given a 5 by 3 Latin rectangle... Find a perfect matching 1 5 3 4 2 How to fill the next row?
Trees Which of the following statements guarantee that a graph is a tree? (n=no. of vertices, m=no. of edges) X 1. The graph has no cycles. 2. The graph is connected with no cycles. 3. The graph is connected with n-1 edges. 4. The graph is connected, but removing every edge disconnect the graph. 5. The graph is connected with minimum number of edges. 6. The graph is connected with every edge as a cut edge. 7. There is exactly one path between any two vertices.
True or False? 1. A tree is a bipartite graph. True. Why? 2. Every graph has a spanning tree. False. Need to be connected graph. 3. Every connected graph has a unique spanning tree. False. Find a counter example. 4. A strongly-connected graph is a directed graph. True... This is definition... 5. We have a strongly-connected graph, if we remove every arrow on the edge, we get an undirected graph, then this undirected graph is 2-edge connected. True. Robin’s Theorem.
True or False? 6. Any graph has an acyclic orientation. True. 7. If there are two simple paths between two vertices, then the graph must have a simple cycle. True. 8. An acyclic directed graph can have at most n-1 edges. False. Find a counter example. 9. Every Eulerian graph has an orientation such that the in degree and out degree of each vertex are the same. True. Find an Eulerian cycle and do something.
There are at least how many edges in a k-path connected graph? Removing any (k-1) edges still keep the graph connected Every vertex must be of degree at least k The sum of degrees are at least kn (handshaking lemma) The sum of edges are at least kn/2