Algorithm Search⌘K

Proofs: Constructing a tree decomposition

These are the human proofs of Constructing a tree decomposition, at full length.

DECOMPOSE returns a tree decomposition of width at most 4k + 4, or a true answer that the treewidth exceeds k full

This proof shows: correctness, termination.

Let G=(V,E)G = (V, E) be a simple graph with nn vertices, and k≥0k \ge 0. For C⊆VC \subseteq V, N(C)N(C) is the set of vertices outside CC with a neighbour in CC. A task (C,S)(C, S) has CC nonempty and connected, and S=N(C)S = N(C).

Lemma 1 (edges). If tw(G)≤k\mathrm{tw}(G) \le k, then ∣E∣≤kn|E| \le kn.

Proof. Take a tree decomposition of width at most kk and remove bags that are subsets of a neighbouring bag; this keeps a decomposition. If n≥1n \ge 1, some leaf bag XtX_t with neighbour XsX_s has a vertex v∈Xt∖Xsv \in X_t \setminus X_s (or tt is the only bag). By the subtree condition, vv is in no other bag, so all neighbours of vv are in XtX_t, and deg⁡v≤k\deg v \le k. Removing vv keeps the treewidth at most kk. By induction on nn, ∣E∣≤kn|E| \le kn. □\square

Lemma 2 (balanced separator). Let HH be a graph with tw(H)≤k\mathrm{tw}(H) \le k and W⊆V(H)W \subseteq V(H). There is a set XX of at most k+1k + 1 vertices such that every connected component of H−XH - X contains at most ∣W∣/2|W|/2 vertices of WW.

Proof. Take a tree decomposition (T,{Xt})(T, \{X_t\}) of HH of width at most kk and root TT. For a node tt, let VtV_t be the union of the bags in the subtree of tt. At the root, ∣W∩Vt∣=∣W∣≥∣W∣/2|W \cap V_t| = |W| \ge |W|/2. Choose a node tt with ∣W∩Vt∣≥∣W∣/2|W \cap V_t| \ge |W|/2 such that every child t′t' of tt has ∣W∩Vt′∣<∣W∣/2|W \cap V_{t'}| < |W|/2; it exists, by walking down from the root. Let X=XtX = X_t, so ∣X∣≤k+1|X| \le k + 1. By the subtree condition, a vertex in Vt′∖XtV_{t'} \setminus X_t for a child t′t' appears only in bags of the subtree of t′t', and a vertex outside VtV_t appears only outside the subtree of tt. Every edge lies in a bag, so an edge of H−XH - X cannot join two of the sets Vt′∖XtV_{t'} \setminus X_t (for different children t′t') and V∖VtV \setminus V_t. So each component DD of H−XH - X lies in one of these sets. If D⊆Vt′∖XtD \subseteq V_{t'} \setminus X_t, then ∣W∩D∣≤∣W∩Vt′∣<∣W∣/2|W \cap D| \le |W \cap V_{t'}| < |W|/2. If D⊆V∖VtD \subseteq V \setminus V_t, then ∣W∩D∣≤∣W∣−∣W∩Vt∣≤∣W∣/2|W \cap D| \le |W| - |W \cap V_t| \le |W|/2. □\square

Lemma 3 (grouping). Let a1,…,ar≥0a_1, \ldots, a_r \ge 0 with ∑ai≤w\sum a_i \le w and each ai≤w/2a_i \le w/2. The indices can be split into two groups, each with sum at most 2w/32w/3.

Proof. If some ai≥w/3a_i \ge w/3, put ii alone in the first group: its sum is at most w/2w/2, and the rest sum to at most w−w/3w - w/3. Otherwise add indices to the first group one at a time until its sum is at least w/3w/3, or no index is left. Before the last addition the sum was below w/3w/3, and the last aia_i is below w/3w/3, so the first group sums to less than 2w/32w/3; the second sums to at most w−w/3=2w/3w - w/3 = 2w/3, or to 00. □\square

Lemma 4 (a split exists). Let (C,S)(C, S) be a task with ∣S∣=3k+4|S| = 3k + 4, and tw(G)≤k\mathrm{tw}(G) \le k. Then line L6 finds a split.

Proof. Apply Lemma 2 to H=G[C∪S]H = G[C \cup S], which has treewidth at most kk, and W=SW = S. Let XX be the set, SX=X∩SS_X = X \cap S, and Y0=X∩CY_0 = X \cap C. Each component of H−XH - X contains at most ∣S∣/2|S|/2 vertices of S∖XS \setminus X. By Lemma 3, with w=∣S∣w = |S|, the components can be grouped so that the vertices of S∖XS \setminus X in the two groups, SAS_A and SBS_B, number at most 2∣S∣/3=2k+8/32|S|/3 = 2k + 8/3 each, so at most 2k+22k + 2 each, being integers. No path in H−XH - X joins SAS_A to SBS_B, since they lie in different components, so Y0Y_0 meets every path from SAS_A to SBS_B in H−SXH - S_X, and ∣Y0∣≤k+1−∣SX∣|Y_0| \le k + 1 - |S_X|. Line L6 tries this split, and the flow finds a cut Y⊆CY \subseteq C of the least size, which is at most ∣Y0∣|Y_0|. □\square

Invariant. Every task on the stack satisfies: CC is nonempty and connected; S=N(C)S = N(C); ∣S∣≤3k+4|S| \le 3k + 4; CC is disjoint from all bags made so far; and the node parent\mathit{parent}, if any, has a bag that contains SS.

Initialization. At line L2, CC is a component, so N(C)=∅N(C) = \emptyset.

Maintenance. Take a task (C,S)(C, S) and its bag B⊇SB \supseteq S, with B∖S⊆CB \setminus S \subseteq C. Let DD be a component of G[C∖B]G[C \setminus B]. It is nonempty, connected, and disjoint from BB and the older bags. A neighbour u∉Du \notin D of a vertex of DD is either in CC, and then in BB, since DD is a whole component of G[C∖B]G[C \setminus B]; or outside CC, and then in N(C)=S⊆BN(C) = S \subseteq B. So N(D)⊆BN(D) \subseteq B, the bag of the new node. For the size: if line L5 was used, ∣N(D)∣≤∣B∣≤∣S∣+1≤3k+4|N(D)| \le |B| \le |S| + 1 \le 3k + 4. If line L8 was used, then DD is connected and avoids Y∪SY \cup S, and every vertex of N(D)∩SN(D) \cap S outside SXS_X is joined to DD by an edge. If N(D)N(D) met both SAS_A and SBS_B, there would be a path from SAS_A to SBS_B through DD that avoids YY and SXS_X, against the choice of YY. So N(D)⊆SA∪SX∪YN(D) \subseteq S_A \cup S_X \cup Y or N(D)⊆SB∪SX∪YN(D) \subseteq S_B \cup S_X \cup Y, and ∣N(D)∣≤(2k+2)+(k+1)=3k+3|N(D)| \le (2k + 2) + (k + 1) = 3k + 3.

Progress. Each task adds at least one vertex of CC to its bag. At line L5 this is clear. At line L8, ∣S∖SX∣≥3k+4−(k+1)=2k+3|S \setminus S_X| \ge 3k + 4 - (k + 1) = 2k + 3, and ∣SA∣,∣SB∣≤2k+2|S_A|, |S_B| \le 2k + 2, so both SAS_A and SBS_B are nonempty. If Y∩C=∅Y \cap C = \emptyset, then Y=∅Y = \emptyset, and in G[C∪S]−SXG[C \cup S] - S_X the connected set CC is adjacent to every vertex of SA∪SBS_A \cup S_B, since S=N(C)S = N(C), which joins SAS_A to SBS_B, a contradiction. So YY contains a vertex of CC.

Termination. By the invariant and progress, the sets CC of all tasks taken from the stack contain distinct new vertices in their bags, and these vertices are never in a later CC. So there are at most nn tasks, and every loop of the algorithm is finite. The search of line L6 is finite.

Theorem. If DECOMPOSE returns "treewidth >k> k", then tw(G)>k\mathrm{tw}(G) > k. Otherwise it returns a tree decomposition of GG in which every bag has at most 4k+54k + 5 vertices. If tw(G)≤k\mathrm{tw}(G) \le k, it does not return "treewidth >k> k".

Proof. The answer "treewidth >k> k" comes from line L1, which is right by Lemma 1, or from line L7, which is right by Lemma 4. So if tw(G)≤k\mathrm{tw}(G) \le k the decomposition is returned.

Suppose a decomposition is returned. The nodes form a forest, since each node except the first of a component is joined to an older node. Bag sizes: at line L5, ∣B∣≤3k+4|B| \le 3k + 4; at line L8, ∣B∣≤∣S∣+∣Y∣≤3k+4+k+1=4k+5|B| \le |S| + |Y| \le 3k + 4 + k + 1 = 4k + 5.

Each vertex is covered, and its bags are connected. Let v∈Vv \in V. It lies in the first task's CC for its component. Follow the tasks whose CC contains vv: each next one is a child task of the last, until a task τ\tau puts vv in its bag, which must happen since every task with v∈Cv \in C either puts vv in its bag or passes it to exactly one child task, and there are finitely many tasks. After τ\tau, vv is in no later CC. A later bag holds vv only through its boundary, as B=S∪(B∩C)B = S \cup (B \cap C). A child task (D,N(D))(D, N(D)) of a node σ\sigma with v∈N(D)v \in N(D) has v∈Bσv \in B_\sigma, since N(D)⊆BσN(D) \subseteq B_\sigma, and its own node is joined to σ\sigma. So every bag that holds vv is joined, by a chain of nodes whose bags hold vv, to the node of τ\tau; these bags form a connected subtree.

Each edge is covered. Let uv∈Euv \in E, and let τ\tau be the first task that puts uu or vv in its bag, say uu. At that moment vv is not in an older bag, so it is in CτC_\tau, as uu and vv were together in each earlier CC (they are adjacent, and none of the earlier bags holds either). If v∈Bτv \in B_\tau, the edge is covered. Otherwise vv lies in a component DD of G[Cτ∖Bτ]G[C_\tau \setminus B_\tau] with u∈N(D)u \in N(D), and the task for DD has u∈Su \in S. Repeat with this task: uu stays in the boundary, by the same argument, until a task puts vv in its bag, whose bag also contains uu as part of SS. ■\blacksquare

Running time. At most nn tasks; each tries at most 3∣S∣≤33k+43^{|S|} \le 3^{3k+4} splits, each with a flow of at most k+2k + 2 augmenting paths on a graph of O(n+m)O(n + m) size, and m≤knm \le kn after line L1. So the time is O(27kk2n2)O(27^k k^2 n^2).

Back to Constructing a tree decomposition