Mathematics for Computer Science Flight Gates MIT 6.042J/18.062J flights need gates, but Graph Coloring times overlap. Bipartite Matching how many gates needed?
Albert R Meyer, March 15, 2010 lec 7M.1 Albert R Meyer, March 15, 2010 lec 7M.2
Airline Schedule Conflicts Among 3 Flights
Needs gate at same time time 145 122 145 Flights 67 257 306 306 99 99
Albert R Meyer, March 15, 2010 lec 7M.3 Albert R Meyer, March 15, 2010 lec 7M.4
Model all Conflicts with a Graph Color the vertices
257 122 145 Color the vertices so that adjacent vertices have different colors. min # distinct colors needed = 67 min # gates needed 306
99
Albert R Meyer, March 15, 2010 lec 7M.5 Albert R Meyer, March 15, 2010 lec 7M.6
1 Coloring the Vertices Better coloring
257 122 145 257 122 145
assign gates: 67 67 306 257, 67 306 122,145 4 colors 99 3 colors 99 306 99 4 gates 3 gates Albert R Meyer, March 15, 2010 lec 7M.7 Albert R Meyer, March 15, 2010 lec 7M.8
Final Exams Model as a Graph
subjects conflict if student 8.02 takes both, so 6.042 18.02 need different time slots. assign times: how short an exam period? 3.091 M 9am 4 time slots M 1pm (best possible) 6.001 T 9am T 1pm
Albert R Meyer, March 15, 2010 lec 7M.9 Albert R Meyer, March 15, 2010 lec 7M.10
Map Coloring Planar Four Coloring
any planar map is 4-colorable. 1850’s: false proof published (was correct for 5 colors). 1970’s: proof with computer 1990’s: much improved
Albert R Meyer, March 15, 2010 lec 7M.12 Albert R Meyer, March 15, 2010 lec 7M.14
© Source unknown. All rights reserved. This content is excluded from our Creative Commons license. For more information, see http://ocw.mit.edu/fairuse.
2 Chromatic Number Trees are 2-colorable root min #colors for G is chromatic number, (G) Pick any vertex as “root.” lemma: if (unique) path from root is even length: (tree) = 2 odd length:
Albert R Meyer, March 15, 2010 lec 7M.15 Albert R Meyer, March 15, 2010 lec 7M.16
Complete Graph K5 Simple Cycles (Ceven) = 2
(C ) = 3 odd (Kn) = n
Albert R Meyer, March 15, 2010 lec 7M.17 Albert R Meyer, March 15, 2010 lec 7M.18
Bounded Degree The Wheel Wn all degrees k, implies (G) k+1 W5 (Wodd) = 4 very simple algorithm… (Weven) = 3
Albert R Meyer, March 15, 2010 lec 7M.19 Albert R Meyer, March 15, 2010 lec 7M.20
3 “Greedy” Coloring coloring arbitrary graphs
…color vertices in any order. 2-colorable? --easy to check next vertex gets a color 3-colorable? --hard to check different from its neighbors. (even if planar) k neighbors, so find (G)? --theoretically k+1 colors always work no harder than 3-color, but harder in practice
Albert R Meyer, March 15, 2010 lec 7M.21 Albert R Meyer, March 15, 2010 lec 7M.24
Compatible Boys & Girls
Bipartite G B Matching
compatible
Albert R Meyer, March 15, 2010 lec 7M.25 Albert R Meyer, March 15, 2010 lec 7M.26
Compatible Boys & Girls Compatible Boys & Girls
G B G B
match each girl to a a matching unique compatible boy
Albert R Meyer, March 15, 2010 lec 7M.27 Albert R Meyer, March 15, 2010 lec 7M.28
4 Compatible Boys & Girls Compatible Boys & Girls
G B G B
suppose this edge was missing suppose this edge was missing
Albert R Meyer, March 15, 2010 lec 7M.29 Albert R Meyer, March 15, 2010 lec 7M.30
Compatible Boys & Girls NotCompatible enough boysBoys & forGirls these girls!
G B G B
3 3 2
3 girls like only 2 boys
Albert R Meyer, March 15, 2010 lec 7M.31 Albert R Meyer, March 15, 2010 lec 7M.32
No match is possible! Noa matchbottleneck is possible!
G B G B
N(S) N(S) S3 2 S
|3S girls| = 3 > 2like = |N(onlyS) 2 |boys |S| > |N(S)| Albert R Meyer, March 15, 2010 lec 7M.33 Albert R Meyer, March 15, 2010 lec 7M.34
5 Bottleneck Lemma Hall’s Theorem
If there is a bottleneck, Conversely, if there are then no match is possible, no bottlenecks, then obviously. there is a match.
Albert R Meyer, March 15, 2010 lec 7M.36 Albert R Meyer, March 15, 2010 lec 7M.37
Hall’s Theorem How to verify no bottlenecks? Hall’s condition fairly efficient matching If |S| |N(S)| for all procedure is known sets of girls, S, then (explained in algorithms there is a match. subjects) …but there is a special situation (proof in Notes) which ensures a match:
Albert R Meyer, March 15, 2010 lec 7M.38 Albert R Meyer, March 15, 2010 lec 7M.47
How to verify no bottlenecks? How to verify no bottlenecks? If every girl likes d boys, If every girl likes d boys, and every boy likes d girls, and every boy likes d girls, then no bottlenecks. then no bottlenecks. proof: say set S of girls has e incident edges: a degree-constrained d|S| e dN(S)| |S| |N(S)| bipartite graph so no bottleneck
Albert R Meyer, March 15, 2010 lec 7M.48 Albert R Meyer, March 15, 2010 lec 7M.49
6 Team Problems Problems 1—4
Albert R Meyer, March 15, 2010 lec 6M.50
7 MIT OpenCourseWare http://ocw.mit.edu
6.042J / 18.062J Mathematics for Computer Science Spring 2010
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.