Proofs: de Fraysseix-Pach-Pollack algorithm
These are the human proofs of de Fraysseix-Pach-Pollack algorithm, at full length.
Correctness of the de Fraysseix-Pach-Pollack algorithm full
This proof shows: correctness, termination.
Setting. is maximal planar with vertices (for the output is the triangle , , ), embedded by a rotation system with outer face counterclockwise, and is a canonical ordering. is the plane graph induced by , and its contour is . By the definition of a canonical ordering, is 2-connected, its bounded faces are triangles, and its outer boundary is the cycle formed by the contour and the edge . We write for the set after step , with .
Termination. The loop of line L3 runs times, and each iteration does a finite amount of work. The canonical ordering exists and is computed by a terminating procedure (see the canonical ordering page). So the algorithm terminates.
Facts about the sets
Lemma 1. For every : , , , and exactly when .
Proof. For : , , . Step (line L8) adds to for , sets , and keeps for . Since and , the chain for the new contour is again strictly decreasing, contains exactly in the sets up to , and gains .
So a sequence defines a monotone shift of : move each vertex of by to the right. Lines L5 and L6 perform the monotone shift of with for up to , for and from on.
Lemma 2 (shifts restrict). Let and let be a monotone shift of . Then the movement of the vertices of is a monotone shift of ; moreover moves by some amount , the vertex by at most , the vertices by exactly , and by at least .
Proof. Let give the value of at for contour vertices of up to and from on, and the value to . It is nondecreasing because lies between and on the contour of . By line L8, for up to , , and from on. So a vertex of lies in for the same contour position under both descriptions, with and their sets merged into the class of . Hence moves by the same amount under and . The statements about , and the covered vertices follow from monotonicity.
The invariants
For , after step (and after any later shifts, which restrict to monotone shifts of by Lemma 2), consider:
- (A) , , and for ; every contour edge satisfies .
- (B) Right after step , every contour edge has slope exactly or .
- (C) Every bounded face of , listed counterclockwise in the embedding, is drawn as a positively oriented triangle: . This holds after step and after any monotone shift of .
(A) and (C) are preserved by monotone shifts: shifts keep y-coordinates, never decrease , and (C) is stated for all monotone shifts.
Base, . The triangle , , : (A) and (B) hold. The only bounded face is , counterclockwise; under a monotone shift moves by , by , by , and .
Step . Assume the invariants for . Lines L5 and L6 apply a monotone shift, after which (A) and (C) hold for , contour edges outside keep slope (both ends move by the same amount), and the edges and have gained 1 in width.
Claim 1: every covered vertex () satisfies and , and also . By (A) summed along the contour, for contour positions before the shift. The shift adds at least 1 to for and at least 1 to for , without changing y-coordinates. This gives strict inequalities.
Placement. Line L7 sets and . By Claim 1 both are positive, so , and they are integers because, by (B) before the shift, was a sum of even numbers , and the shift added 2. So the new contour satisfies (A), and its two new edges have slopes and , so (B) holds. Also .
Claim 2: for every covered . From Claim 1, and . The point lies on both lines and , so and .
The new faces. The bounded faces of not in are the triangles for , counterclockwise, since lies left of and is above. Write .
- If and , both and are covered. Write (by (A)) and , with . By Claim 2, , so .
- If : is on the line of slope through , so by Claim 1 (or by when ).
- If : symmetric, with the line of slope through .
So (C) holds right after step . For a later monotone shift of , Lemma 2 says that the movement restricted to is a monotone shift (so the old faces stay positive by the invariant for ), and that relative to , the vertex moves left by some , moves right by some , and the covered vertices do not move. Each is an affine function of . Its partial derivative in (when is a corner) is or , and in (when is a corner) is or ; all are positive by Claim 2 and by . So the only grow and stay positive. This proves (C) for .
No crossings
Lemma 3. Let be a 2-connected plane graph whose bounded faces are triangles, and suppose a straight-line drawing of (not assumed plane) draws every bounded face, listed counterclockwise, as a positively oriented triangle, and draws the outer boundary cycle, listed counterclockwise, as a simple polygon . Then the drawing has no crossings.
Proof. For a point that lies on no drawn edge and is not a vertex, let be the number of drawn bounded faces that contain . A positively oriented triangle has winding number 1 around its interior points and 0 around exterior points, so . Each inner edge appears in two bounded faces with opposite directions, so the sum telescopes to the winding number of the outer boundary: , which is 1 inside and 0 outside. If two edges crossed at an interior point, or a vertex lay in the interior of a drawn edge or face, then points near it would lie in two drawn faces: each edge has a drawn face on each side locally (or on one side for an edge of ), and the faces at an interior vertex cover a neighbourhood with total angle times a positive integer. That gives for some , which is impossible.
Theorem. The output is a straight-line drawing of without crossings, with integer coordinates in , that realizes the given rotation system.
Proof. After step , , every bounded face is a positively oriented triangle by (C), and the outer boundary is the triangle , , with above, which is a simple counterclockwise polygon. Lemma 3 gives a plane drawing. Since every face, including the outer one, keeps its cyclic order and orientation, the counterclockwise order of neighbours at each vertex is the input rotation. The coordinates are integers by the placement argument. Each step adds 2 to , so ; attaches to , , so ; and (A) puts every contour vertex, hence every vertex, inside the triangle , , .
The offset implementation computes the same coordinates
Let the shift tree have root , with the next contour vertex as a child of each contour vertex, the first covered vertex as a child of the vertex that covers it, and each covered vertex's successor in its covered chain as its child. Each vertex stores its x-offset to its parent, and is the sum of offsets on the path from the root.
Lemma 4. After every step, for each contour vertex , the descendants of in the shift tree are exactly , and the stored offsets give the same x-coordinates as the explicit shifts.
Proof. For the tree is the path with offsets , and the descendant sets are . At step : adding 1 to the offset of moves exactly its descendants by 1, and adding 1 to the offset of moves by 1 more, as in lines L5 and L6. The sum of the offsets of is . Then becomes the child of with offset , becomes a child of with offset , and , if covered, becomes a child of with its offset reduced by ; the covered chain keeps its internal offsets. No absolute coordinate changes in this rewiring. The descendants of are , the covered chain with its subtrees, and with its subtree, which is ; the descendants of the vertices up to gain ; the others are unchanged. This is line L8.
So the implementation outputs the coordinates of the explicit method, which are correct by the theorem.