Title: Drawing a Planar Graph on a Grid
1Drawing a Planar Graph on a Grid
2Last Week
- Any planar graph has a Straight-line drawing
- But it might take a lot of space
3Grid
- Grid point a point with integer coordinates
- m by n grid the set of grid points (x, y) with
- 0 x m
- 0 y n
- Map each vertex in the graph to a grid point
- Goal - minimize the size of the needed grid
4Theorem
- Any planar graph with n vertices has a
straight-line embedding on the 2n-4 by n-2 grid.
n 6
n - 2
2n - 4
5Proof
- G triangulation
- Exterior face of G u v w
- v1 u, v2 v, v3, ... , vn w canonical
labeling of the vertices of G - Gk the sub-graph of G induced by v1, v2, ... ,
vk
G
G6
6Each graph Gk can be embedded on the 2k-4 by k-2
Grid
- By induction on k, show that Gk can be embedded
on the 2k-4 by k-2 grid (k 3) - k 3
f3(v3) (1, 1)
2k 4 2 K 2 1 2 by 1 grid
f3(v1) (0, 0)
f3(v2) (2, 0)
7Induction Hypothesis
- Assume we already foundfk-1(vi) (xk-1(vi),
yk-1(vi)) (1 i k-1), (4 k) - Where
- fk-1(v1) (0, 0), fk-1(v2) (2k 6, 0)
- Exterior face monotonic in x (cyclic order)
- The segments fk-1(ui) , fk-1(ui1) all have
slopes 1 or -1
K 7, k-1 6 2k 4 10 K 2 5 10 by 5
grid
u3
u4
u2
u1
u6
fk-1(v1) (0, 0)
fk-1(v2) (2k 6, 0)
8Show for k
- Wed like to define fk(vk) (draw vk)
- up, up1, ... , uq the neighbors of vk in Gk
- Good Candidate P(up, uq)
- We might have a problem...
vks neighbors in Gk are u3, u4, u5
u3
u4
u2
u1
u6
f6(v1) (0, 0)
f6(v2) (8, 0)
9Problem
- Assume vks neighbors in Gk are u2, u3, u4, u5
How do we connect vk to u2 with a straight line?
u3
u4
u2
u1
u6
f6(v1) (0, 0)
f6(v2) (8, 0)
10Modify the previous embedding
- Modify fk-1 first
- Move fk-1(ui) where p1 i q-1 one unit to the
right - Move fk-1(uj) where q j m two units to the
right
vks neighbors in Gk u2, u3, u4, u5
u2
u1
f6(v1) (0, 0)
f6(v2) (8, 0)
11Another Problem
- What about the interior vertices?
Insert v8 with neighbors u2, u3, u4, u5 in G8
u3
v7
u5
u4
u3
v6
u2
v4
u4
v5
u5
u1
v1
v2
u6
12Define a New Order
- Define a total order on v1, v2, ... , vn
recursively - v1 v3 v2
- Assume the order has already been defined for
v1, v2, ... , vk-1 - Insert vk just before up1
f3(v3) (1, 1)
f3(v1) (0, 0)
f3(v2) (2, 0)
13Example
v7s Neighbors in G7 u2, u3, u4, u5
v7
u5
u3
v6
u2
v4
u4
v5
u1
u6
v1
v2
v7
... v4 (u2)
v6 (u3) ...
14Solution continued
- Now modifing fk-1 will be defined as
- Move fk-1(ui) where up1 ui uq-1 one unit
to the right - Move fk-1(uj) where uq uj um two units to
the right
Insert v8 with neighbors u2, u3, u4, u5 in G8
u3
v7
u4
v6
u2
v4
v5
u5
v2
u1
v1
... v4 v7 v6 ...
15Prove fk is a Straight Line Embedding
- Assume that fk-1 is a straight line embedding of
Gk-1 - fk-1(vi) (xk-1(vi), yk-1(vi))
- a1, a2, ... ,am 0
- For any 1 i k-1 , 1 j m
- x(vi) xk-1(vi) a1 a2 ... aj if uj
vi uj1 - y(vi) yk-1(vi)
- Then f k-1 (x, y) is also a straight line
embedding of Gk-1
16Induction Base
- k 4
- a1, a2, a3, a4
- x(v1) xk-1(v1) a1 , since u1 v1 u2
- x(v4) xk-1(v4) a1 a2 , since u1 v4
u2 ,u2 v4 u3 - x(v3) xk-1(v3) a1 a2 a3
- x(v2) xk-1(v2) a1 a2 a3 a4
v4 u2
v3
v2 u3
v1 u1
17Show For Gk
- u1, ... , up, vk, uq, ... , um the exterior
face of Gk - Fix a(u1), a(u2), ... , a(up), a(vk), a(uq), ...
, a(um) - Take Gk-1, and a1 a(u1), ... , ap a(up),
ap1 a(vk) 1, ap2 0, ... , aq a(uq)
1, aq1 a(uq1), ... , am a(um) - Apply the induction hypothesis the restriction
of f k to Gk-1 is a straight line embedding. - Also vks edges dont create any crossing
18Questions?