Algorithm Search⌘K

Proofs: Lipton-Tarjan separator algorithm

These are the human proofs of Lipton-Tarjan separator algorithm, at full length.

The Lipton-Tarjan algorithm returns a balanced separator of size at most 2 sqrt(2) sqrt(n) full

This proof shows: correctness, termination.

Let G=(V,E)G = (V, E) be a simple planar graph with n≥1n \ge 1 vertices and a planar rotation system ρ\rho. We show that LT-SEPARATOR stops and returns a partition (A,B,S)(A, B, S) of VV with no edge between AA and BB, ∣A∣,∣B∣≤2n/3|A|, |B| \le 2n/3, and ∣S∣≤22n|S| \le 2\sqrt{2}\sqrt{n}. Every loop of the algorithm runs over a finite set and every search visits each vertex once, so the algorithm stops. We prove the three properties.

Step 1 (it suffices that every component of G−SG - S has at most 2n/32n/3 vertices). Line L13 groups the components. If one component has at least n/3n/3 vertices, it alone forms AA, which has at most 2n/32n/3 vertices, and BB has at most n−n/3=2n/3n - n/3 = 2n/3. Otherwise, components are added to AA while ∣A∣<n/3|A| < n/3; each has fewer than n/3n/3 vertices, so ∣A∣<2n/3|A| < 2n/3 at the end, and BB, if nonempty, is formed only after ∣A∣≥n/3|A| \ge n/3, so ∣B∣≤2n/3|B| \le 2n/3. No edge joins two components, so no edge joins AA and BB.

Step 2 (line L1). If the largest component has at most 2n/32n/3 vertices, then S=∅S = \emptyset satisfies Step 1. Otherwise all later lines work in KK, with ∣K∣>2n/3|K| > 2n/3. Every other component has fewer than n/3n/3 vertices. So it suffices that every component of K−SK - S has at most 2∣K∣/3≤2n/32|K|/3 \le 2n/3 vertices and that ∣S∣≤22∣K∣|S| \le 2\sqrt{2}\sqrt{|K|}.

Step 3 (levels). In a breadth-first search every edge joins two vertices whose levels differ by at most 1. So after removing all vertices of a level LiL_i, no edge joins a vertex below LiL_i to a vertex above it. By the choice of ℓ1\ell_1, the levels below ℓ1\ell_1 hold fewer than ∣K∣/2|K|/2 vertices and the levels above ℓ1\ell_1 hold ∣K∣−k≤∣K∣/2|K| - k \le |K|/2. If line L3 stops, S=Lℓ1S = L_{\ell_1} has at most 22∣K∣2\sqrt{2}\sqrt{|K|} vertices, and every component of K−SK - S lies on one side of Lℓ1L_{\ell_1}, so it has at most ∣K∣/2|K|/2 vertices.

Step 4 (lines L4 and L5 find levels). The claim in the proof of the planar separator theorem shows that some ℓ∈[ℓ1−⌊k⌋,ℓ1]\ell \in [\ell_1 - \lfloor\sqrt{k}\rfloor, \ell_1] satisfies the test of line L4, and that some ℓ≥ℓ1+1\ell \ge \ell_1 + 1 satisfies the test of line L5, with ℓ=r+1\ell = r + 1 as the last resort. So both scans stop, and

∣Lℓ0∣+∣Lℓ2∣+2(ℓ2−ℓ0−1)≤2k+2∣K∣−k≤22∣K∣,(1)|L_{\ell_0}| + |L_{\ell_2}| + 2(\ell_2 - \ell_0 - 1) \le 2\sqrt{k} + 2\sqrt{|K| - k} \le 2\sqrt{2}\sqrt{|K|}, \tag{1}

because k+∣K∣−k\sqrt{k} + \sqrt{|K| - k} is largest at k=∣K∣/2k = |K|/2. After removing Lℓ0∪Lℓ2L_{\ell_0} \cup L_{\ell_2}, each component of K−SK - S lies in the levels below ℓ0\ell_0 (fewer than ∣K∣/2|K|/2 vertices, since ℓ0≤ℓ1\ell_0 \le \ell_1), or above ℓ2\ell_2 (at most ∣K∣/2|K|/2, since ℓ2>ℓ1\ell_2 > \ell_1), or in MM. If line L6 stops, ∣M∣≤2∣K∣/3|M| \le 2|K|/3, and the bound on ∣S∣|S| follows from (1).

Step 5 (line L7 builds a plane graph HH with a tree of small radius). Let RR be the levels 0,…,ℓ00, \ldots, \ell_0. The search tree restricted to RR is a tree TRT_R rooted at qq. Contracting one edge uvuv of a plane graph merges uu and vv, and the rotation of the merged vertex is ρu\rho_u with vv replaced by the neighbours of vv in the order of ρv\rho_v, starting after uu and stopping before uu; the result is again a plane graph, possibly with parallel edges and loops. Contracting the edges of TRT_R one at a time, children into parents, gives exactly the order of the Euler tour of line L7: at each vertex, scan its rotation counterclockwise starting after the parent, and descend into each child where it occurs. Edges inside RR become loops and are dropped, edges to levels ℓ2\ell_2 and above are deleted with those vertices, and of each set of parallel edges at xx one is kept. Deleting edges and vertices keeps a plane graph plane. So HH is a simple plane graph with rotation ρH\rho_H.

HH is connected: each vertex of MM has a search-tree path down to level ℓ0+1\ell_0 + 1, and from there one edge to xx (or, if ℓ0=−1\ell_0 = -1, the path down to q∈Mq \in M). Let THT_H be these paths. Every vertex of MM has depth at most ℓ2−1−ℓ0\ell_2 - 1 - \ell_0 in THT_H.

Step 6 (line L8 gives a triangulation). For each face ff of HH with walk of darts d0,…,dk−1d_0, \ldots, d_{k-1}, the corner of ff at the tail of djd_j is the counterclockwise side of djd_j, because ff is on the left of djd_j. Adding cfc_f inside ff and an edge from cfc_f to each corner, in the order of the walk, splits ff into the kk triangles cf,tail(dj),head(dj)c_f, \text{tail}(d_j), \text{head}(d_j). These have three distinct vertices, since HH has no loops. Inserting the new edge right after djd_j in the rotation of its tail, and listing the new edges at cfc_f in walk order, which is counterclockwise around cfc_f, describes this drawing. So the result Δ\Delta is a plane graph with no loops in which every face is a triangle on three distinct vertices. The proof of the lemma of the planar separator theorem uses only these facts, the cycle and bond duality, the tree-cotree property and the Jordan curve theorem, all of which hold for such graphs with parallel edges.

Step 7 (line L9 gives a spanning tree). TT consists of THT_H and, for each cfc_f, the edge to the corner of d0d_0. Each cfc_f is a leaf of TT. A tree path between two vertices never passes through a leaf except at its ends. So a fundamental cycle CeC_e contains at most the two ends of ee among the new vertices, and its vertices of HH form a path in THT_H. If CeC_e passes through xx, it has at most 2(ℓ2−ℓ0−1)2(\ell_2 - \ell_0 - 1) vertices of MM, two branches of depth at most ℓ2−ℓ0−1\ell_2 - \ell_0 - 1 below xx. If it does not, its top vertex zz has depth at least 1 and the bound is 2(ℓ2−ℓ0−2)+12(\ell_2 - \ell_0 - 2) + 1. If ℓ0=−1\ell_0 = -1, qq is the root and the vertices of MM have depth at most ℓ2−1\ell_2 - 1, which gives at most 2(ℓ2−1)+1=2(ℓ2−ℓ0−1)−12(\ell_2 - 1) + 1 = 2(\ell_2 - \ell_0 - 1) - 1. In each case, with (1),

∣S∣≤∣Lℓ0∣+∣Lℓ2∣+2(ℓ2−ℓ0−1)≤22∣K∣.|S| \le |L_{\ell_0}| + |L_{\ell_2}| + 2(\ell_2 - \ell_0 - 1) \le 2\sqrt{2}\sqrt{|K|}.

Step 8 (line L11 computes the weights). Root T∗T^* at the face f0f_0. For a non-tree edge ee, let gg be the end of e∗e^* farther from f0f_0 and d=(u,v)d = (u, v) the dart of ee with gg on its left. As shown in the proof of the lemma, the faces in the subtree of gg, F(g)F(g), are exactly the faces inside CeC_e, the side without f0f_0.

For each vertex yy, the owner face o(y)o(y) is the face on the left of the dart from yy to its parent (for the root, the face of its first dart). A vertex strictly inside CeC_e has all its faces inside, so o(y)∈F(g)o(y) \in F(g); a vertex strictly outside has o(y)∉F(g)o(y) \notin F(g). So

Σ(g)=∑o(y)∈F(g)w(y)=w(inside Ce)+∑y∈Ce, o(y)∈F(g)w(y).\Sigma(g) = \sum_{o(y) \in F(g)} w(y) = w(\text{inside } C_e) + \sum_{y \in C_e,\ o(y) \in F(g)} w(y).

Orient CeC_e as u→vu \to v, then up the tree from vv to z=lca(u,v)z = \text{lca}(u, v), then down to uu. The face gg is on the left of the first dart, and the inside is on one side of the whole oriented cycle, so the inside is on the left everywhere. For y≠zy \ne z on the branch from vv, the cycle uses the dart from yy to its parent, whose left face o(y)o(y) is inside. For y≠zy \ne z on the branch from uu, the cycle uses the dart from the parent to yy; its left face is inside, and o(y)o(y) is the face on the other side of the same edge, so it is outside. The owner of zz is tested directly by its position in T∗T^*. Hence

w(inside Ce)=Σ(g)−(P(v)−P(z))−[o(z)∈F(g)] w(z),w(\text{inside } C_e) = \Sigma(g) - \big(P(v) - P(z)\big) - [o(z) \in F(g)]\, w(z),

where P(y)P(y) is the weight of the tree path from yy up to the root, and w(Ce)=P(u)+P(v)−2P(z)+w(z)w(C_e) = P(u) + P(v) - 2P(z) + w(z) sums the two branches and zz once. These are the formulas of line L11.

Step 9 (line L11 finds a balanced cycle). The weights are 1 on MM and 0 on xx and the new vertices, with total ∣M∣|M|. By the lemma of the planar separator theorem, applied to Δ\Delta, TT and w/∣M∣w / |M|, a candidate exists, and the candidate with the fewest faces inside has weight at most 2∣M∣/32|M|/3 strictly inside CeC_e, and weight ∣M∣−w(inside)−w(Ce)≤2∣M∣/3|M| - w(\text{inside}) - w(C_e) \le 2|M|/3 strictly outside. By the Jordan curve theorem, no edge of Δ\Delta, hence no edge of GG between vertices of MM, joins the two sides. Line L12 adds the vertices of MM on CeC_e to SS. Every component of K−SK - S inside MM lies on one side of CeC_e and has at most 2∣M∣/3≤2∣K∣/32|M|/3 \le 2|K|/3 vertices, and the components outside MM were bounded in Step 4.

Conclusion. In every case every component of G−SG - S has at most 2n/32n/3 vertices and ∣S∣≤22∣K∣≤22n|S| \le 2\sqrt{2}\sqrt{|K|} \le 2\sqrt{2}\sqrt{n}. By Step 1, the output (A,B,S)(A, B, S) is a separator with the stated properties. ■\blacksquare

Back to Lipton-Tarjan separator algorithm