Mikołaj Bojańczyk

In this page we prove Theorem 1 below, which says that tree decompositions of slightly suboptimal width can be computed in cubic time. More precisely, we show that for every k \in \Nat there is a cubic time algorithm which inputs a graph and fails or outputs a tree decomposition of width <3k. The algorithm succeeds if the input graph has tree width < k. The constants in the cubic time depend exponentially on k.  The theorem includes a set of distinguished vertices, which are used in its proof, but for external purposes like Courcelle’s Theorem one can assume that the set of distinguished vertices is empty.

Theorem 1. Fix k \in \Nat. There is a cubic time algorithm which does this:

  • Input: A graph with at most 3k distinguished vertices;
  • Output: Failure, or a tree decomposition of the graph which has width  <3k and has all distinguished vertices in the root bag.

If the input graph has treewidth  <k then the algorithm succeeds.

The result mentioned at the beginning is the special case of Theorem 1 when there are no distinguished vertices. The constant in the running time of the algorithm is exponential in k. Theorem 1 is not the optimal result. One can improve it in two ways: a) the running time can be made linear; and b) the tree decompositions computed can have optimal width. The two improvements can be done together. For Courcelle’s Theorem, we do not need optimal width tree decompositions, so improvement b) would not change anything. On the other hand, improvement a) would make the running time in Courcelle’s Theorem linear. Since both improvements a) and b) require substantial technical work, we present Theorem 1 in its present, suboptimal form, since that can be rather easily shown.

The rest of this page is devoted to proving Theorem 1. In the algorithm, we use the following result on computing separators.

Theorem 2. Given a graph G and disjoint sets of vertices X,Y, one can compute in quadratic time (in the number of edges) a separator of minimal size. Recall that a separator is a set of vertices S disjoint from X \cup Y such that G-S does not contain any path connecting X with Y.

We do not prove the above theorem, it can be shown using the Ford-Fulkerson algorithm. Actually, more fancy algorithms have subquadratic running time. The main step in proving Theorem 1 is the following lemma.

Lemma. Let k \in \Nat. There is a quadratic time algorithm, which does this:

  • Input: A graph with a set W of at most 3k distinguished vertices.
  • Output: Failure, or a set S of at most k vertices in the graph, and a partition of W-S into two parts X,Y, each part of size at most 2k and such that S separates the two parts. 

If the input graph has treewidth  <k then the algorithm succeeds.

Proof of the lemma. We begin with the algorithm, and only later we justify why it must succeed on graphs of treewidth <k. Let the input graph be G. We enumerate all possible partitions of W into three parts X,Y,Z, such that Z has size at most k, and each of X,Y has size at most 2k. The idea is that Z is the intersection W \cap S. The number of such partitions is exponential in k, but is a constant if k is assumed to be fixed. For each such partition, we compute a minimal size separator S of X and Y in the graph G-Z, and we report success if the combined size of S and Z is at most k. This completes the algorithm.

We now justify that if G has treewidth <k then the algorithm succeeds. If the graph has treewidth k, then there is a tree decomposition where all bags have size at most k. Let t be this tree decomposition. Choose a node v of the tree decomposition so that at least half of the distinguished vertices of G appear in bags of v and its descendants, but this is no longer true for any of the children of v. Define S to be the bag of v, the size of S is at most k. Furthermore, by choice of v we know that every connected component of G-S has at most half the distinguished vertices.

It remains to show that W-S can be partitioned into two parts, call them X and Y, such that S separates them, and each part has size at most 2k. To do this suppose that G-S has n connected components, and for i \in \set{1,\ldots,n} define W_i to be the distinguished vertices in the i-th connected component of G-S. Since each W_i has at most half of the distinguished vertices, it follows that there must be some I \subseteq \set{1,\ldots,n} such that both of the sets

    \[X = \bigcup_{i \in I} W_i \qquad Y= \bigcup_{i \in \set{1,\ldots,n} -I} W_i\]

have at most two thirds of the distinguished vertices, i.e. at most 2k distinguished vertices. \Box

 

Proof of Theorem 1. Suppose that G is a graph and W is a set of at most 3k distinguished vertices. If there are less than 3k distinguished vertices, we add some arbitrary vertices to make the set have size exactly 3k. Apply the lemma, computing S,X and Y. If the input graph has treewidth <k then the algorithm from the lemma must succeed. Find all connected components of the graph G-S. We know that each connected component has at most 2k distinguished vertices. For each set of vertices U which is a connected component of the graph G-S, recursively call the algorithm for the subgraph of G induced by U \cup S, with the distinguished vertices being (U \cap W) \cup S; let t_U be the resulting tree decomposition. Note that we are allowed to do the recursive call, since U \cap W has at most 2k vertices and S has at most k vertices, and thus there are at most 3k distinguished vertices. The tree decomposition for the entire graph G looks like this. The root bag consists of the distinguished vertices W. For each connected component U in G-S, we add the tree decomposition t_U as a child of the root. It is not difficult to check that this is a tree decomposition of G. The algorithm does a quadratic computation, followed by recursive calls to smaller instances; and therefore its running time is cubic. \Box