In graph theory, the treewidth of an undirected graph is a number associated with the graph. Treewidth may be defined in several equivalent ways: from the size of the largest vertex set in a tree decomposition of the graph, from the size of the largest clique in a chordal completion of the graph, from the maximum order of a haven describing a strategy for a pursuit-evasion game on the graph, or from 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. The graphs with treewidth at most k are also called partial k-trees; many other well-studied graph families also have bounded treewidth.
The concept of treewidth was originally introduced by Umberto Bertelé and Francesco Brioschi (1972) under the name of dimension. It was later rediscovered by Rudolf Halin (1976), based on properties that it shares with a different graph parameter, the Hadwiger number. Later it was again rediscovered by Neil Robertson and Paul Seymour (1984) and has since been studied by many other authors.
- 1 Definition
- 2 Examples
- 3 Bounded treewidth
- 4 Algorithms
- 5 Related parameters
- 6 Notes
- 7 References
A tree decomposition of a graph G = (V, E) is a tree, T, with nodes X1, ..., Xn, where each Xi is a subset of V, satisfying the following properties (the term node is used to refer to a vertex of T to avoid confusion with vertices of G):
- The union of all sets Xi equals V. That is, each graph vertex is contained in at least one tree node.
- If Xi and Xj both contain a vertex v, then all nodes Xk of the tree in the (unique) path between Xi and Xj contain v as well. Equivalently, the tree nodes containing vertex v form a connected subtree of T.
- For every edge (v, w) in the graph, there is a subset Xi that contains both v and w. That is, vertices are adjacent in the graph only when the corresponding subtrees have a node in common.
The width of a tree decomposition is the size of its largest set Xi minus one. The treewidth 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 that both belong to at least one of the sets Xi.
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 β that maps each set X of at most k vertices in G into one of the connected components of G \ X and that obeys the monotonicity property that β(Y) ⊆ β(X) whenever X ⊆ Y.
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.
Every complete graph Kn 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 triangle, from which it follows that its treewidth is at least two.
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 × 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:
- F is a minor-closed family of bounded-treewidth graphs;
- One of the finitely many forbidden minors characterizing F is planar;
- F is a minor-closed graph family that does not include all planar graphs.
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 >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 K4.
- For k = 3, there are four forbidden minors: K5, 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 the exponential of the square root of k. However, known upper bounds on the size and number of forbidden minors are much higher than this lower bound.
Computing the treewidth
It is 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.
|Unsolved problem in mathematics:
In practice, an algorithm of Shoikhet & Geiger (1997) 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.
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 Bodlaender (1998). 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 graph of treewidth k may be solved by using a dynamic programming algorithm on a tree decomposition of the graph. For each set Xi of the tree decomposition, and each partition of the vertices of Xi 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(kk + O(1)n), a time bound that makes this problem fixed-parameter tractable.
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 state 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 (), membership tests (e.g, ), quantifications over vertices, edges, sets of vertices, sets of edges (e.g., , , , ), adjacency 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 , this problem asks if it is possible to assign each vertex one of the 3 colors such that no two adjacent vertices are assigned the same color. This problem can be expressed in monadic second order logic as follows:
where represent the subsets of vertices having each of the 3 colors. 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.
The pathwidth of a graph has a very similar definition to treewidth via tree decompositions, but is restricted to tree decompositions in which the underlying tree of the decomposition is a path graph. Alternatively, the pathwidth may be defined from interval graphs analogously to the definition of treewidth from chordal graphs. As a consequence, the pathwidth of a graph is always at least as large as its treewidth, but it can only be larger by a logarithmic factor. Another parameter, the graph bandwidth, has an analogous definition from proper interval graphs, and is at least as large as the pathwidth. Other related parameters include the tree-depth, a number that is bounded for a minor-closed graph family if and only if the family excludes a path, and the degeneracy, a measure of the sparsity of a graph that is at most equal to its treewidth.
Grid minor size
Because the treewidth of an n × n grid graph is n, the treewidth of a graph G is always greater than or equal to the size of the largest square grid minor of G. In the other direction, the grid minor theorem by Robertson and Seymour shows that there exists a function f such that the treewidth is at most f(r) where r is the size of the largest square grid minor. The best bounds known on f are that f must be at least Ω(rd) for some fixed constant d>0, and at most O(√). Tighter bounds are known for restricted graph families, leading to efficient algorithms for many graph optimization problems on those families through the theory of bidimensionality. Halin's grid theorem provides an analogue of the relation between treewidth and grid minor size for infinite graphs.
Diameter and local treewidth
A family F of graphs is said to have bounded local treewidth, or the diameter-treewidth property, if the treewidth of the graphs in the family is upper bounded by a function of their diameter. If every minor of a member of F is also in F, then F has bounded local treewidth if and only if one of the forbidden minors for F is an apex graph. The original proofs of this result showed that treewidth in an apex-minor-free graph family grows at most doubly exponentially as a function of diameter; later this was reduced to singly exponential and finally to a linear bound. Bounded local treewidth is closely related to the algorithmic theory of bidimensionality, and every graph property definable in first order logic can be decided for an apex-minor-free graph family in an amount of time that is only slightly superlinear.
It is also possible for a class of graphs that is not closed under minors to have bounded local treewidth. In particular this is true of the 1-planar graphs, graphs that can be drawn in the plane with one crossing per edge, and more generally for the graphs that can be drawn on a surface of bounded genus with a bounded number of crossings per edge. As with minor-closed graph families of bounded local treewidth, this property has pointed the way to efficient approximation algorithms for these graphs.
Hadwiger number and S-functions
Halin (1976) defines a class of graph parameters that he calls S-functions, which include the treewidth. These functions from graphs to integers are required to be zero on graphs with no edges, to be minor-monotone, to increase by one when a new vertex is added that is adjacent to all previous vertices, and to take the larger value from the two subgraphs on either side of a clique separator. The set of all such functions forms a complete lattice under the operations of elementwise minimization and maximization. The top element in this lattice is the treewidth, and the bottom element is the Hadwiger number, the size of the largest complete minor in the given graph.
- Diestel (2005) pp.354–355
- Diestel (2005) section 12.3
- Seymour & Thomas (1993).
- Bodlaender (1998).
- Thorup (1998).
- Robertson & Seymour (1986).
- Bodlaender (1988).
- Arnborg, Proskurowski & Corneil (1990); Satyanarayana & Tung (1990).
- Ramachandramurthi (1997).
- Lagergren (1993).
- Arnborg, Corneil & Proskurowski (1987).
- Bodlaender (1996).
- Kao (2008).
- Bertelé & Brioschi (1972).
- Arnborg & Proskurowski (1989); Bern, Lawler & Wong (1987); Bodlaender (1988).
- Courcelle, B. (1990). "The monadic second-order logic of graphs I: Recognizable sets of finite graphs". Information and Computation (85): 12–75.
- Courcelle, B. (1992). "The monadic second-order logic of graphs III: Treewidth, forbidden minors and complexity issues.". Informatique Théorique (26): 257–286.
- Robertson, Seymour. Graph minors. V. Excluding a planar graph. 
- Chekuri & Chuzhoy (2013). For the Ω notation in the lower bound, see big O notation.
- Demaine & Hajiaghayi (2008).
- Diestel (2004).
- Eppstein (2000).
- Eppstein (2000); Demaine & Hajiaghayi (2004a).
- Demaine & Hajiaghayi (2004b).
- Demaine et al. (2004); Demaine & Hajiaghayi (2008).
- Frick & Grohe (2001).
- Grigoriev & Bodlaender (2007).
- Arnborg, S.; Corneil, D.; Proskurowski, A. (1987), "Complexity of finding embeddings in a k-tree", SIAM Journal on Matrix Analysis and Applications, 8 (2): 277–284, doi:10.1137/0608024.
- Arnborg, Stefan; Proskurowski, Andrzej; Corneil, Derek G. (1990), "Forbidden minors characterization of partial 3-trees", Discrete Mathematics, 80 (1): 1–19, doi:10.1016/0012-365X(90)90292-P, MR 1045920.
- Arnborg, S.; Proskurowski, A. (1989), "Linear time algorithms for NP-hard problems restricted to partial k-trees", Discrete Applied Mathematics, 23 (1): 11–24, doi:10.1016/0166-218X(89)90031-0.
- Bern, M. W.; Lawler, E. L.; Wong, A. L. (1987), "Linear-time computation of optimal subgraphs of decomposable graphs", Journal of Algorithms, 8 (2): 216–235, doi:10.1016/0196-6774(87)90039-3.
- Bertelé, Umberto; Brioschi, Francesco (1972), Nonserial Dynamic Programming, Academic Press, ISBN 0-12-093450-7.
- Bodlaender, Hans L. (1988), "Dynamic programming on graphs with bounded treewidth", Proc. 15th International Colloquium on Automata, Languages and Programming, Lecture Notes in Computer Science, 317, Springer-Verlag, pp. 105–118, doi:10.1007/3-540-19488-6_110.
- Bodlaender, Hans L. (1996), "A linear time algorithm for finding tree-decompositions of small treewidth", SIAM Journal on Computing, 25 (6): 1305–1317, doi:10.1137/S0097539793251219.
- Bodlaender, Hans L. (1998), "A partial k-arboretum of graphs with bounded treewidth", Theoretical Computer Science, 209 (1–2): 1–45, doi:10.1016/S0304-3975(97)00228-4.
- Chekuri, Chandra.; Chuzhoy, Julia (2013), Polynomial Bounds for the Grid-Minor Theorem, arXiv:.
- Demaine, Erik D.; Fomin, Fedor V.; Hajiaghayi, MohammadTaghi; Thilikos, Dimitrios M. (2004), "Bidimensional parameters and local treewidth", SIAM Journal on Discrete Mathematics, 18 (3): 501–511, doi:10.1137/S0895480103433410, MR 2134412.
- Demaine, Erik D.; Hajiaghayi, MohammadTaghi (2004a), "Diameter and treewidth in minor-closed graph families, revisited", Algorithmica, 40 (3): 211–215, doi:10.1007/s00453-004-1106-1, MR 2080518.
- Demaine, Erik D.; Hajiaghayi, MohammadTaghi (2004b), "Equivalence of local treewidth and linear local treewidth and its algorithmic applications", Proceedings of the Fifteenth Annual ACM-SIAM Symposium on Discrete Algorithms, New York: ACM, pp. 840–849, MR 2290974.
- Demaine, Erik D.; Hajiaghayi, MohammadTaghi (2008), "Linearity of grid minors in treewidth with applications through bidimensionality" (PDF), Combinatorica, 28 (1): 19–36, doi:10.1007/s00493-008-2140-4.
- Diestel, Reinhard (2004), "A short proof of Halin's grid theorem", Abhandlungen aus dem Mathematischen Seminar der Universität Hamburg, 74: 237–242, doi:10.1007/BF02941538, MR 2112834.
- Diestel, Reinhard (2005), Graph Theory (3rd ed.), Springer, ISBN 3-540-26182-6.
- Eppstein, D. (2000), "Diameter and treewidth in minor-closed graph families", Algorithmica, 27 (3-4): 275–291, doi:10.1007/s004530010020, MR 1759751.
- Frick, Markus; Grohe, Martin (2001), "Deciding first-order properties of locally tree-decomposable structures", Journal of the ACM, 48 (6): 1184–1206, doi:10.1145/504794.504798, MR 2143836.
- Grigoriev, Alexander; Bodlaender, Hans L. (2007), "Algorithms for graphs embeddable with few crossings per edge", Algorithmica, 49 (1): 1–11, doi:10.1007/s00453-007-0010-x, MR 2344391.
- Halin, Rudolf (1976), "S-functions for graphs", Journal of Geometry, 8: 171–186, doi:10.1007/BF01917434.
- Kao, Ming-Yang, ed. (2008), "Treewidth of graphs", Encyclopedia of Algorithms, Springer, p. 969, ISBN 9780387307701,
Another long-standing open problem is whether there is a polynomial-time algorithm to compute the treewidth of planar graphs.
- Lagergren, Jens (1993), "An upper bound on the size of an obstruction", Graph structure theory (Seattle, WA, 1991), Contemporary Mathematics, 147, Providence, RI: American Mathematical Society, pp. 601–621, doi:10.1090/conm/147/01202, MR 1224734.
- Ramachandramurthi, Siddharthan (1997), "The structure and number of obstructions to treewidth", SIAM Journal on Discrete Mathematics, 10 (1): 146–157, doi:10.1137/S0895480195280010, MR 1430552.
- Robertson, Neil; Seymour, Paul D. (1984), "Graph minors III: Planar tree-width", Journal of Combinatorial Theory, Series B, 36 (1): 49–64, doi:10.1016/0095-8956(84)90013-3.
- Robertson, Neil; Seymour, Paul D. (1986), "Graph minors V: Excluding a planar graph", Journal of Combinatorial Theory, Series B, 41 (1): 92–114, doi:10.1016/0095-8956(86)90030-4.
- Robertson, Neil; Seymour, Paul; Thomas, Robin (1994), "Quickly excluding a planar graph", Journal of Combinatorial Theory, Series B, 62 (2): 323–348, doi:10.1006/jctb.1994.1073, MR 1305057.
- Satyanarayana, A.; Tung, L. (1990), "A characterization of partial 3-trees", Networks, 20 (3): 299–322, doi:10.1002/net.3230200304, MR 1050503.
- Seymour, Paul D.; Thomas, Robin (1993), "Graph Searching and a Min-Max Theorem for Tree-Width.", Journal of Combinatorial Theory, Series B, 58 (1): 22–33, doi:10.1006/jctb.1993.1027.
- Shoikhet, Kirill; Geiger, Dan (1997), "A practical algorithm for finding optimal triangulations", Proc. AAAI '97 (PDF), pp. 185–190.
- Thorup, Mikkel (1998), "All structured programs have small tree width and good register allocation", Information and Computation, 142 (2): 159–181, doi:10.1006/inco.1997.2697.