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 be a simple graph with vertices and edges. A rotation system on a graph defines darts for every edge , and the face permutation , where is the neighbour just before in . Its cycles are the faces. For a connected graph with at least one edge, , with equality if and only if is the rotation system of a planar embedding; we call such a planar. For a disconnected graph, 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 .
Claim 1 (the subgraph is maximal planar). At the end of phase 1, is planar and is not planar for every .
Proof. Edges are added to only when the result is planar, so stays planar. Let , rejected when the subgraph was . Then is not planar, and . A subgraph of a planar graph is planar, so is not planar.
Claim 2 (removed edges stay within a component). For every , the vertices and lie in the same component of .
Proof. If not, would join two components of a planar graph by a bridge: draw the two components in disjoint discs, with and on their outer faces, and join them by a curve outside both. This is planar, contradicting Claim 1.
The vertices of are those of plus dummy vertices, and the dummy vertices are added to the component that contains the inserted edge. So the components of have the same original vertices as the components of throughout.
Lemma 3 (subdivision). Let be a rotation system with an edge . Replace by in , by in , and set . Then the faces are the same, except that the dart is replaced by the two darts in its face, and by in its face.
Proof. with just before in , so . And with just before in , which is the neighbour that was just before , so is the old . A dart with before now has . The other values of do not change. The same holds for .
So a subdivision adds one vertex and one edge and keeps the number of faces. is unchanged, and stays planar.
Lemma 4 (inserting an edge into one face). Let be a face with corners and , where and are not adjacent. Insert between and in , and between and in . Then is split into two faces, and every other face is unchanged.
Proof. Write the cycle of as , where is the run of darts from to and the run from to . After the insertion, is just before in , so , and because is just before in . So followed by is a cycle. In the same way and , so followed by is a cycle. For any other dart , the neighbour just before in is unchanged, because the only new entries are , placed just before in , and , placed just before in .
The insertion adds one edge and one face, keeps the vertices, and keeps and in one component. So is unchanged, and stays planar.
Claim 5 (termination of the search). At line L7, the search reaches a face at .
Proof. By Claim 2 and the remark after it, and lie in one component of . The dual of the connected plane graph is connected: two faces of that share a vertex are joined by a dual path that crosses the edges at one after another, and any two faces are linked by a chain of faces sharing vertices along a path of . The faces at are faces of , so the search reaches one.
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 is incident to or , the faces are distinct, and each has on one side and on the other, with .
Proof. Both faces on the two sides of an edge contain , so both have distance 0, and a shortest dual path never crosses . Both faces on the sides of an edge contain , so the search stops at the first of them that it reaches and never crosses . A shortest path in the dual repeats no face, so the are distinct, and a dual edge that leads from a face to itself is never used, because the face is already visited.
Claim 7 (each insertion keeps the embedding planar and creates true crossings). After lines L8 and L9, is planar, and at each the two paths through alternate.
Proof. By Lemma 3, line L8 keeps planar and keeps the faces , with the dart of replaced by and the dart of replaced by . So has the corner at , and has the corner . The edges of line L9 are added one by one: the edge (with and ) goes into , at the corner of in and the corner of in . The faces are distinct by Claim 6, so when the -th edge is added, the face and its corners have not been touched by the earlier edges, which only split and changed corners in those faces. The two ends are distinct and not adjacent. By Lemma 4, each addition keeps planar.
At , the edge from the earlier face goes between and (the corner after ), and the edge to the later face between and (the corner after ). So : the neighbours of the two paths alternate.
Claim 8 (every removed edge is crossed). Every is inserted with .
Proof. Suppose and shared a face of when is inserted. Draw without crossings and add inside that face. In this drawing, the edges of are curves through dummy vertices, the earlier inserted edges are other curves through them, and crosses nothing. Erase the earlier inserted edges, and treat the dummy vertices on edges of as interior points of those curves. What remains is a crossing-free drawing of , which contradicts Claim 1.
Claim 9 (each insertion is optimal for the current embedding). No curve from to , drawn in the current embedding of through no vertex and crossing edges transversally, crosses fewer than edges.
Proof. Such a curve starts in a face at , ends in a face at , 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 to a face at , with one dual edge per crossing. The search returns a shortest such walk, of length .
Conclusion. By Claims 7 and 5, after all insertions is a planar rotation system of . Every edge of in is a path in whose inner vertices are dummy vertices of later insertions, and every edge in is the path ; each edge of 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 is a planarization of with crossings, built on the maximal planar subgraph 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.