Skip to content
Surf Wiki
Save to docs
general/graph-invariants

From Surf Wiki (app.surf) — the open knowledge base

Treewidth

Number denoting a graph's closeness to a tree

Treewidth

Summary

Number denoting a graph's closeness to a tree

In graph theory, the treewidth of an undirected graph is an integer number which specifies, informally, how far the graph is from being a tree. The smallest treewidth is 1; the graphs with treewidth 1 are exactly the trees and the forests. An example of graphs with treewidth at most 2 are the series–parallel graphs. The maximal graphs with treewidth exactly k are called k-trees, and the graphs with treewidth at most k are called partial k-trees. Many other well-studied graph families also have bounded treewidth.

Treewidth may be formally defined in several equivalent ways: in terms of the size of the largest vertex set in a tree decomposition of the graph, in terms of the size of the largest clique in a chordal completion of the graph, in terms of the maximum order of a haven describing a strategy for a pursuit–evasion game on the graph, or in terms of the maximum order of a bramble, a collection of connected subgraphs that all touch each other.

Treewidth is commonly used as a parameter in the parameterized complexity analysis of graph algorithms. Many algorithms that are NP-hard for general graphs, become easier when the treewidth is bounded by a constant.

The concept of treewidth was originally introduced by under the name of dimension. It was later rediscovered by , based on properties that it shares with a different graph parameter, the Hadwiger number. Later it was again rediscovered by and has since been studied by many other authors.

Definition

A graph with eight vertices, and a tree decomposition of it onto a tree with six nodes. Each graph edge connects two vertices that are listed together at some tree node, and each graph vertex is listed at the nodes of a contiguous subtree of the tree. Each tree node lists at most three vertices, so the width of this decomposition is two.

A tree decomposition of a graph G=(V,E) is a tree T in which each node is associated with a subset of vertices called a "bag". (The term node is used to refer to a vertex of T to avoid confusion with vertices of G). The bags X_1,\dots X_t must satisfy the following properties:

  1. Each graph vertex is contained in at least one bag: \textstyle\bigcup_i X_i=V
  2. If bags X_i and X_j both contain a vertex v, then all bags X_k associated with nodes in the (unique) path of T between X_i and X_j also contain v as well. Equivalently, the bags containing vertex v are associated with a connected subtree of T.
  3. For every edge (v,w) in the graph, there is at least one bag X_i that contains both v and w. That is, vertices are adjacent in the graph only when their corresponding subtrees have a node in common. (However, two vertices may belong to a bag without being adjacent to each other.) The width of a tree decomposition is the size of its largest bag X_i minus one. The treewidth \operatorname{tw}(G) of a graph G is the minimum width among all possible tree decompositions of G. In this definition, the size of the largest set is diminished by one in order to make the treewidth of a tree equal to one.

Equivalently, the treewidth of G is one less than the size of the largest clique in the chordal graph containing G with the smallest clique number. A chordal graph with this clique size may be obtained by adding to G an edge between every two vertices for which at least one bag contains both vertices.

Treewidth may also be characterized in terms of havens, functions describing an evasion strategy for a certain pursuit–evasion game defined on a graph. A graph G has treewidth k if and only if it has a haven of order k+1 but of no higher order, where a haven of order k+1 is a function \beta that maps each set X of at most k vertices in G into one of the connected components of G\setminus Xand that obeys the monotonicity property that \beta(Y)\subseteq\beta(X) whenever X\subset Y.

bramble]] of order four in a 3×3 grid graph, the existence of which shows that the graph has treewidth at least 3

A similar characterization can also be made using brambles, families of connected subgraphs that all touch each other (meaning either that they share a vertex or are connected by an edge). The order of a bramble is the smallest hitting set for the family of subgraphs, and the treewidth of a graph is one less than the maximum order of a bramble.

Examples

Every complete graph K_n has treewidth n-1. This is most easily seen using the definition of treewidth in terms of chordal graphs: the complete graph is already chordal, and adding more edges cannot reduce the size of its largest clique.

A connected graph with at least two vertices has treewidth 1 if and only if it is a tree. A tree has treewidth one by the same reasoning as for complete graphs (namely, it is chordal, and has maximum clique size two). Conversely, if a graph has a cycle, then every chordal completion of the graph includes at least one triangle consisting of three consecutive vertices of the cycle, from which it follows that its treewidth is at least two.

Bounded treewidth

Graph families with bounded treewidth

For any fixed constant k, the graphs of treewidth at most k are called the partial k-trees. Other families of graphs with bounded treewidth include the cactus graphs, pseudoforests, series–parallel graphs, outerplanar graphs, Halin graphs, and Apollonian networks. The control-flow graphs arising in the compilation of structured programs also have bounded treewidth, which allows certain tasks such as register allocation to be performed efficiently on them.

The planar graphs do not have bounded treewidth, because the n\times n grid graph is a planar graph with treewidth exactly n. Therefore, if F is a minor-closed graph family with bounded treewidth, it cannot include all planar graphs. Conversely, if some planar graph cannot occur as a minor for graphs in family F, then there is a constant k such that all graphs in F have treewidth at most k. That is, the following three conditions are equivalent to each other:

  1. F is a minor-closed family of bounded-treewidth graphs;
  2. One of the finitely many forbidden minors characterizing F is planar;
  3. F is a minor-closed graph family that does not include all planar graphs.

Forbidden minors

5}}}} (top-left), the graph of the octahedron (bottom-left), the Wagner graph (top-right), and the graph of the pentagonal prism (bottom-right)

For every finite value of k, the graphs of treewidth at most k may be characterized by a finite set of forbidden minors. (That is, any graph of treewidth greater than k includes one of the graphs in the set as a minor.) Each of these sets of forbidden minors includes at least one planar graph.

  • For k=1, the unique forbidden minor is a 3-vertex cycle graph.
  • For k=2, the unique forbidden minor is the 4-vertex complete graph K_4.
  • For k=3, there are four forbidden minors: K_5, the graph of the octahedron, the pentagonal prism graph, and the Wagner graph. Of these, the two polyhedral graphs are planar. For larger values of k, the number of forbidden minors grows at least as quickly as an exponential function of \sqrt k. However, known upper bounds on the size and number of forbidden minors are much higher than this lower bound.

Algorithms

Computing the treewidth

It is \mathsf{NP}-complete to determine whether a given graph G has treewidth at most a given variable k. However, when k is any fixed constant, the graphs with treewidth k can be recognized, and a width k tree decomposition constructed for them, in linear time. The time dependence of this algorithm on k is exponential.

Due to the roles the treewidth plays in an enormous number of fields, different practical and theoretical algorithms computing the treewidth of a graph were developed. Depending on the application on hand, one can prefer better approximation ratio, or better dependence in the running time from the size of the input or the treewidth. The table below provides an overview of some of the treewidth algorithms. Here k is the treewidth and n is the number of vertices of an input graph G. Each of the algorithms outputs in time f(k)\cdot g(n) a decomposition of width given in the Approximation column. For example, the algorithm of in time 2^{O(k^3)}\cdot n either constructs a tree decomposition of the input graph G of width at most k or reports that the treewidth of G is more than k. Similarly, the algorithm of in time 2^{O(k)}\cdot n either constructs a tree decomposition of the input graph G of width at most 5k+4 or reports that the treewidth of G is more than k. improved the width of the decomposition to 2k+1 in the same running time.

Approximationf(k)g(n)reference
exact1O(n^{k+2})
4k+3O(3^{3k})O(n^2)
8k+72^{O(k\log n)}O(n\log^2n)
5k+4 (or 7k+6)2^{O(k\log n)}O(n\log n)
exact2^{O(k^3)}O(n)
O \left( k \cdot \sqrt{\log k} \right)1n^{O(1)}
4.5k+42^{3k}O(n^2)
\tfrac{11}{3}k+42^{3.6982k}O(n^3\log^4n)
exact1O(1.7347^n)
3k+22^{O(k)}O(n\log n)
5k+42^{O(k)}O(n)
k^2k^7O(n\log n)
5k+42^{8.765k}O(n\log n)
2k+12^{O(k)}O(n)
5k+42^{6.755k}O(n\log n)
exact2^{O(k^2)}O(n^4)
(1+\varepsilon)kk^{O(k/\varepsilon)}O(n^4)

It is not known whether determining the treewidth of planar graphs is NP-complete, or whether their treewidth can be computed in polynomial time.

In practice, an algorithm of can determine the treewidth of graphs with up to 100 vertices and treewidth up to 11, finding a chordal completion of these graphs with the optimal treewidth.

For larger graphs, one can use search-based techniques such as branch and bound search to compute the treewidth. These algorithms are anytime in that when stopped early, they will output an upper bound on the treewidth. An algorithm of this type was proposed in 2004 by Vibhav Gogate and Rina Dechter. To provide a lower bound on treewidth for the branches of this search, they construct a graph minor by repeatedly contracting an edge between a minimum degree vertex and one of its neighbors, until just one vertex remains. The maximum of the minimum degree over these constructed minors is guaranteed to be a lower bound on the treewidth of the graph. Alex Dow and Rich Korf further improved this algorithm using best-first search.

Solving other problems on graphs of small treewidth

At the beginning of the 1970s, it was observed that a large class of combinatorial optimization problems defined on graphs could be efficiently solved by non serial dynamic programming as long as the graph had a bounded dimension, a parameter shown to be equivalent to treewidth by . Later, several authors independently observed at the end of the 1980s that many algorithmic problems that are NP-complete for arbitrary graphs may be solved efficiently by dynamic programming for graphs of bounded treewidth, using the tree-decompositions of these graphs.

As an example, the problem of coloring a graph of treewidth k may be solved by using a dynamic programming algorithm on a tree decomposition of the graph. For each bag X_i of the tree decomposition, and each partition of the vertices of X_i into color classes, the algorithm determines whether that coloring is valid and can be extended to all descendant nodes in the tree decomposition, by combining information of a similar type computed and stored at those nodes. The resulting algorithm finds an optimal coloring of an n-vertex graph in time O(k^{k+O(1)}n), a time bound that makes this problem fixed-parameter tractable.

Courcelle's theorem

Main article: Courcelle's theorem

For a large class of problems, there is a linear time algorithm to solve a problem from the class if a tree-decomposition with constant bounded treewidth is provided. Specifically, Courcelle's theorem states that if a graph problem can be expressed in the logic of graphs using monadic second order logic, then it can be solved in linear time on graphs with bounded treewidth. Monadic second order logic is a language to describe graph properties that uses the following constructions:

  • Logic operations, such as \wedge ,\vee ,\neg ,\Rightarrow
  • Membership tests, such as e\in E, v\in V
  • Quantifications over vertices, edges, sets of vertices, and/or sets of edges, such as \forall v\in V, \exists e\in E, \exists I\subset V, \forall F\subset E
  • Vertex–edge incidence tests (u is an endpoint of e), and some extensions that allow for things such as optimization.

Consider for example the 3-coloring problem for graphs. For a graph G=(V,E), this problem asks if it is possible to assign each vertex v\in V one of three colors such that no two adjacent vertices are assigned the same color. This problem can be expressed in monadic second order logic as \exists W_1 \subseteq V\ \exists W_2 \subseteq V\ \exists W_3 \subseteq V\ \left( \begin{align} & \forall v \in V\ (v \in W_1 \vee v \in W_2 \vee v \in W_3) \wedge{} \ & \operatorname{independent}(W_1) \wedge{} \ & \operatorname{independent}(W_2) \wedge{} \ & \operatorname{independent}(W_3) \ \end{align} \right), where W_1,W_2, W_3 represent the subsets of vertices having each of the three colors, and where the subexpressions \operatorname{independent}(W_i) are defined to mean \operatorname{independent}(W_i)\equiv \forall e\in E\ \exist v\in V\ (\operatorname{endpoint}(v,e)\wedge \neg v\in W_i). (It is not necessary to include in this formula the requirement that the sets W_i be disjoint.) Therefore, by Courcelle's results, the 3-coloring problem can be solved in linear time for a graph given a tree-decomposition of bounded constant treewidth.

Notes

References

  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation | editor1-last = Uehara | editor1-first = Ryuhei | editor2-last = Hong | editor2-first = Seok-Hee | editor2-link = Seok-Hee Hong | editor3-last = Nandy | editor3-first = Subhas C.
  • {{citation | editor1-last = Du | editor1-first = Ding-Zhu | editor2-last = Du | editor2-first = Donglei | editor3-last = Wu | editor3-first = Chenchen | editor4-last = Xu | editor4-first = Dachuan
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • .
  • .
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{Citation
  • {{citation | contribution-url = https://www.aaai.org/Library/AAAI/2007/aaai07-182.php
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation | editor1-last = Chickering | editor1-first = David Maxwell | editor2-last = Halpern | editor2-first = Joseph Y.
  • {{citation
  • {{Citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation | editor1-last = Kosaraju | editor1-first = S. Rao | editor2-last = Fellows | editor2-first = Mike | editor3-last = Wigderson | editor3-first = Avi | editor4-last = Ellis | editor4-first = John A.
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation
  • {{citation | editor1-last = Kuipers | editor1-first = Benjamin | editor2-last = Webber | editor2-first = Bonnie L. | contribution-url = https://www.aaai.org/Library/AAAI/1997/aaai97-029.php
  • {{citation
  • {{citation | editor1-last = Saha | editor1-first = Barna | editor2-last = Servedio | editor2-first = Rocco A.

References

  1. {{harvtxt. Diestel. 2005 pp.354–355
  2. {{harvtxt. Diestel. 2005 section 12.3
  3. {{harvtxt. Seymour. Thomas. 1993.
  4. {{harvtxt. Bodlaender. 1998.
  5. {{harvtxt. Thorup. 1998.
  6. {{harvtxt. Robertson. Seymour. 1986.
  7. {{harvtxt. Arnborg. Proskurowski. Corneil. 1990; {{harvtxt. Satyanarayana. Tung. 1990.
  8. {{harvtxt. Bodlaender. 1996.
  9. {{harvtxt. Arnborg. Proskurowski. 1989; {{harvtxt. Bern. Lawler. Wong. 1987; {{harvtxt. Bodlaender. 1988.
  10. {{harvtxt. Courcelle. 1990; {{harvtxt. Courcelle. 1992
  11. {{harvtxt. Chekuri. Chuzhoy. 2016
  12. {{harvtxt. Eppstein. 2000; {{harvtxt. Demaine. Hajiaghayi. 2004a.
  13. {{harvtxt. Demaine. Fomin. Hajiaghayi. Thilikos. 2004; {{harvtxt. Demaine. Hajiaghayi. 2008.
Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about Treewidth — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report