Mathematics for Computer Science
Mathematics for Computer Science
MIT 6.042J/18.062J
MIT 6.042J/18.062J
Planar Graphs; Bipartite Matching
Copyright © Albert R. Meyer, 2005.
Planar Graphs
lec 5f.1
October 7, 2005
Planar Graphs
Copyright © Albert R. Meyer, 2005.
lec 5f.2
October 7, 2005
Planar Graphs
A graph is planar if there is a way to draw it in the plane without edges crossing.
Copyright © Albert R. Meyer, 2005.
lec 5f.3
October 7, 2005
Copyright © Albert R. Meyer, 2005.
A Planar Graph
Planar Graphs
Maps are 2-connected planar graphs
with 43 faces (wait! also the outer face)
General connected planar graphs may have
dongles
lec 5f.4
October 7, 2005
1
2
4 3
cross bars 4
3 1
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.5
Copyright © Albert R. Meyer, 2005.
October 7, 2005
2 lec 5f.6
1
Planar Graphs
Planar Graphs
and record faces while drawing
draw it edge by edge:
graph faces (the outer face) Copyright © Albert R. Meyer, 2005.
lec 5f.7
October 7, 2005
Planar Graphs
Copyright © Albert R. Meyer, 2005.
Planar Graphs
and record faces while drawing
and record faces while drawing
graph
graph
faces
faces
(the outer face) Copyright © Albert R. Meyer, 2005.
(the outer face) lec 5f.9
October 7, 2005
If you like curves…
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.10
“Planar Drawing” = Faces
With same faces, you can draw the graph in the plane big or small, curvy or straight:
An (abstract) planar drawing is defined to be its set of faces. The same planar graph may have different drawings.
4 1
lec 5f.8
October 7, 2005
2 3
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.11
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.12
2
Euler's Formula
Team Problem
If a connected planar drawing has v vertices, e edges, and f faces, then
Problem 1
v–e+f = 2
Copyright © Albert R. Meyer, 2005.
lec 5f.13
October 7, 2005
Euler's Formula
Copyright © Albert R. Meyer, 2005.
lec 5f.14
October 7, 2005
Adding an edge to a drawing
Inductive step: any n+1 edge drawing
comes from adding an edge to some n
edge drawing.
(not a buildup error: it’s the definition of drawing edge by edge) So can assume Euler for n edge drawing and see what happens to v–e+f when 1 edge is added.
Proof by induction on # edges
in drawing:
base case: no edges
connected, so v = 1
outside face only, so f = 1
e=0
1−0+1 = 2 Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.15
Adding an edge to a drawing
Copyright © Albert R. Meyer, 2005.
lec 5f.16
October 7, 2005
Face Creation Rules
1) choose face add edge to new vertex
Two cases for connected graph: 1) Attach edge from vertex on a face to a new vertex. 2) Attach edge between vertices on a face.
path x w v
old face vxv Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.17
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.18
3
Face Creation Rules
Face Creation Rules
1) choose face add edge to new vertex
1) choose face add edge to new vertex
path x
nothing else changes w v
new face is wvxvw Copyright © Albert R. Meyer, 2005.
new face is wvxvw lec 5f.19
October 7, 2005
Euler’s Formula
Copyright © Albert R. Meyer, 2005.
lec 5f.20
October 7, 2005
Face Creation Rules
2) choose face add edge across it w
v increases by 1 e increases by 1 f stays the same
x y v
so v–e+f stays the same
old face: wxvyw Copyright © Albert R. Meyer, 2005.
lec 5f.21
October 7, 2005
Face Creation Rules
Copyright © Albert R. Meyer, 2005.
lec 5f.22
October 7, 2005
Face Creation Rules
2) choose face add edge across it w
2) choose face add edge across it w w
x v
v
splits into 2 faces: Copyright © Albert R. Meyer, 2005.
x
y
y
October 7, 2005
v
splits into 2 faces: wxvw, vywv lec 5f.23
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.24
4
Face Creation Rules
Euler’s Formula
2) choose face add edge across it
v stays the same e increases by 1 f increases by 1 so v–e+f stays the same
nothing else changes
splits into 2 faces: wxvw, vywv Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.25
Copyright © Albert R. Meyer, 2005.
Team Problems
Euler’s Formula
Problems
2 & 3
Inductive step:
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.26
October 7, 2005
lec 5f.27
Copyright © Albert R. Meyer, 2005.
lec 5f.28
October 7, 2005
Compatible Boys & Girls
Mathematics for Computer Science MIT 6.042J/18.062J
Bipartite Matching: Hall’s Theorem
B
G
compatible Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.29
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.30
5
Compatible Boys & Girls
Compatible Boys & Girls
B
G
match each girl to a unique compatible boy Copyright © Albert R. Meyer, 2005.
a matching lec 5f.31
October 7, 2005
Copyright © Albert R. Meyer, 2005.
Compatible Boys & Girls
no match possible lec 5f.33
October 7, 2005
Copyright © Albert R. Meyer, 2005.
No match possible
lec 5f.34
October 7, 2005
Bottleneck condition
B
G
B
G
suppose this edge was missing Copyright © Albert R. Meyer, 2005.
lec 5f.32
October 7, 2005
Compatible Boys & Girls
B
G
B
G
B
G
N(S)
S
|N(S)|=2
|S|=3 because of bottleneck Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.35
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.36
6
Bottleneck Lemma
Hall’s Theorem
bottleneck: not enough boys for some set of girls.
If there is a bottleneck, then no match is possible. S ⊆ G, N(S ) ::= {b | b adjacent to a g ∈ S } , | S | > | N(S ) | Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.37
Hall’s Theorem
There is a perfect match iff
there are no bottlenecks.
Proof in Notes: clever strong induction on #girls. (Better proof using duality principle goes beyond 6.042) Copyright © Albert R. Meyer, 2005.
Problem 4
Lots of elegant use in applications & proofs
October 7, 2005
lec 5f.38
Team Problem
There is a perfect match iff
there are no bottlenecks.
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.39
Copyright © Albert R. Meyer, 2005.
October 7, 2005
lec 5f.40
7