Algorithm Search⌘K

Proofs: Planarization heuristic

These are the human proofs of Planarization heuristic, at full length.

The planarization heuristic outputs a planarization of G, with a maximal planar subgraph and locally optimal insertions full

This proof shows: correctness, termination.

Let G=(V,E)G = (V, E) be a simple graph with nn vertices and mm edges. A rotation system ρ\rho on a graph HH defines darts (a,b)(a, b) for every edge abab, and the face permutation φ(a,b)=(b,c)\varphi(a, b) = (b, c), where cc is the neighbour just before aa in ρ(b)\rho(b). Its cycles are the faces. For a connected graph with at least one edge, V−E+F≤2V - E + F \le 2, with equality if and only if ρ\rho is the rotation system of a planar embedding; we call such a ρ\rho planar. For a disconnected graph, ρ\rho is planar when it is planar on every component. We assume that the test at line L3 is correct and that line L4 returns a planar rotation system of PP.

Claim 1 (the subgraph is maximal planar). At the end of phase 1, PP is planar and P+eP + e is not planar for every e∈Re \in R.

Proof. Edges are added to PP only when the result is planar, so PP stays planar. Let e∈Re \in R, rejected when the subgraph was Pt⊆PP_t \subseteq P. Then Pt+eP_t + e is not planar, and Pt+e⊆P+eP_t + e \subseteq P + e. A subgraph of a planar graph is planar, so P+eP + e is not planar. □\square

Claim 2 (removed edges stay within a component). For every uv∈Ruv \in R, the vertices uu and vv lie in the same component of PP.

Proof. If not, P+uvP + uv would join two components of a planar graph by a bridge: draw the two components in disjoint discs, with uu and vv on their outer faces, and join them by a curve outside both. This is planar, contradicting Claim 1. □\square

The vertices of HH are those of PP plus dummy vertices, and the dummy vertices are added to the component that contains the inserted edge. So the components of HH have the same original vertices as the components of PP throughout.

Lemma 3 (subdivision). Let ρ\rho be a rotation system with an edge xyxy. Replace yy by dd in ρ(x)\rho(x), xx by dd in ρ(y)\rho(y), and set ρ(d)=(x,y)\rho(d) = (x, y). Then the faces are the same, except that the dart (x,y)(x, y) is replaced by the two darts (x,d),(d,y)(x, d), (d, y) in its face, and (y,x)(y, x) by (y,d),(d,x)(y, d), (d, x) in its face.

Proof. φ(x,d)=(d,c)\varphi(x, d) = (d, c) with cc just before xx in (x,y)(x, y), so c=yc = y. And φ(d,y)=(y,c′)\varphi(d, y) = (y, c') with c′c' just before dd in ρ(y)\rho(y), which is the neighbour that was just before xx, so φ(d,y)\varphi(d, y) is the old φ(x,y)\varphi(x, y). A dart (z,x)(z, x) with φ(z,x)=(x,y)\varphi(z, x) = (x, y) before now has φ(z,x)=(x,d)\varphi(z, x) = (x, d). The other values of φ\varphi do not change. The same holds for (y,x)(y, x). □\square

So a subdivision adds one vertex and one edge and keeps the number of faces. V−E+FV - E + F is unchanged, and ρ\rho stays planar.

Lemma 4 (inserting an edge into one face). Let ff be a face with corners (a,x),(x,c)(a, x), (x, c) and (a′,y),(y,c′)(a', y), (y, c'), where x≠yx \ne y and x,yx, y are not adjacent. Insert yy between cc and aa in ρ(x)\rho(x), and xx between c′c' and a′a' in ρ(y)\rho(y). Then ff is split into two faces, and every other face is unchanged.

Proof. Write the cycle of ff as A,BA, B, where AA is the run of darts from (x,c)(x, c) to (a′,y)(a', y) and BB the run from (y,c′)(y, c') to (a,x)(a, x). After the insertion, yy is just before aa in ρ(x)\rho(x), so φ(a,x)=(x,y)\varphi(a, x) = (x, y), and φ(x,y)=(y,c′)\varphi(x, y) = (y, c') because c′c' is just before xx in ρ(y)\rho(y). So BB followed by (x,y)(x, y) is a cycle. In the same way φ(a′,y)=(y,x)\varphi(a', y) = (y, x) and φ(y,x)=(x,c)\varphi(y, x) = (x, c), so AA followed by (y,x)(y, x) is a cycle. For any other dart (z,w)(z, w), the neighbour just before zz in ρ(w)\rho(w) is unchanged, because the only new entries are yy, placed just before aa in ρ(x)\rho(x), and xx, placed just before a′a' in ρ(y)\rho(y). □\square

The insertion adds one edge and one face, keeps the vertices, and keeps xx and yy in one component. So V−E+FV - E + F is unchanged, and ρ\rho stays planar.

Claim 5 (termination of the search). At line L7, the search reaches a face at vv.

Proof. By Claim 2 and the remark after it, uu and vv lie in one component KK of HH. The dual of the connected plane graph KK is connected: two faces of KK that share a vertex zz are joined by a dual path that crosses the edges at zz one after another, and any two faces are linked by a chain of faces sharing vertices along a path of KK. The faces at vv are faces of KK, so the search reaches one. □\square

The search is a breadth-first search on a finite graph, and the loops at lines L2, L5, L8 and L9 are finite, so the algorithm terminates.

Claim 6 (the search avoids the ends). No crossed edge eie_i is incident to uu or vv, the faces f0,…,fkf_0, \ldots, f_k are distinct, and each eie_i has fi−1f_{i-1} on one side and fif_i on the other, with fi−1≠fif_{i-1} \ne f_i.

Proof. Both faces on the two sides of an edge uzuz contain uu, so both have distance 0, and a shortest dual path never crosses uzuz. Both faces on the sides of an edge vzvz contain vv, so the search stops at the first of them that it reaches and never crosses vzvz. A shortest path in the dual repeats no face, so the fif_i are distinct, and a dual edge that leads from a face to itself is never used, because the face is already visited. □\square

Claim 7 (each insertion keeps the embedding planar and creates true crossings). After lines L8 and L9, ρ\rho is planar, and at each did_i the two paths through did_i alternate.

Proof. By Lemma 3, line L8 keeps ρ\rho planar and keeps the faces f0,…,fkf_0, \ldots, f_k, with the dart (xi,yi)(x_i, y_i) of fi−1f_{i-1} replaced by (xi,di),(di,yi)(x_i, d_i), (d_i, y_i) and the dart (yi,xi)(y_i, x_i) of fif_i replaced by (yi,di),(di,xi)(y_i, d_i), (d_i, x_i). So fi−1f_{i-1} has the corner (xi,di),(di,yi)(x_i, d_i), (d_i, y_i) at did_i, and fif_i has the corner (yi,di),(di,xi)(y_i, d_i), (d_i, x_i). The edges of line L9 are added one by one: the edge di−1did_{i-1} d_i (with d0=ud_0 = u and dk+1=vd_{k+1} = v) goes into fi−1f_{i-1}, at the corner of di−1d_{i-1} in fi−1f_{i-1} and the corner of did_i in fi−1f_{i-1}. The faces f0,…,fkf_0, \ldots, f_k are distinct by Claim 6, so when the ii-th edge is added, the face fi−1f_{i-1} and its corners have not been touched by the earlier edges, which only split f0,…,fi−2f_0, \ldots, f_{i-2} and changed corners in those faces. The two ends are distinct and not adjacent. By Lemma 4, each addition keeps ρ\rho planar.

At did_i, the edge from the earlier face goes between yiy_i and xix_i (the corner after yiy_i), and the edge to the later face between xix_i and yiy_i (the corner after xix_i). So ρ(di)=(xi,di+1,yi,di−1)\rho(d_i) = (x_i, d_{i+1}, y_i, d_{i-1}): the neighbours of the two paths alternate. □\square

Claim 8 (every removed edge is crossed). Every uv∈Ruv \in R is inserted with k≥1k \ge 1.

Proof. Suppose uu and vv shared a face of HH when uvuv is inserted. Draw HH without crossings and add uvuv inside that face. In this drawing, the edges of PP are curves through dummy vertices, the earlier inserted edges are other curves through them, and uvuv crosses nothing. Erase the earlier inserted edges, and treat the dummy vertices on edges of PP as interior points of those curves. What remains is a crossing-free drawing of P+uvP + uv, which contradicts Claim 1. □\square

Claim 9 (each insertion is optimal for the current embedding). No curve from uu to vv, drawn in the current embedding of HH through no vertex and crossing edges transversally, crosses fewer than kk edges.

Proof. Such a curve starts in a face at uu, ends in a face at vv, and passes from one face to the next only when it crosses an edge separating them. So the faces it visits form a walk in the dual from a face at uu to a face at vv, with one dual edge per crossing. The search returns a shortest such walk, of length kk. □\square

Conclusion. By Claims 7 and 5, after all insertions ρ\rho is a planar rotation system of HH. Every edge of GG in PP is a path in HH whose inner vertices are dummy vertices of later insertions, and every edge in RR is the path u,d1,…,dk,vu, d_1, \ldots, d_k, v; each edge of HH lies on exactly one of these paths, since a split replaces one edge of a path by two edges of the same path, and line L9 adds the edges of the new path. Every dummy vertex has degree 4 and lies on exactly two paths, which alternate there by Claim 7. So (H,ρ)(H, \rho) is a planarization of GG with ∣D∣|D| crossings, built on the maximal planar subgraph PP of Claim 1, with at least one crossing per removed edge by Claim 8 and a fewest-crossings route for each insertion in the current embedding by Claim 9. ■\blacksquare

Back to Planarization heuristic