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 are called k-tree, and the graphs with treewidth at most are called partial k-tree. 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 . 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. pp.354–355
Equivalently, the treewidth of is one less than the size of the largest clique in the chordal graph containing with the smallest maximum clique. A chordal graph with this clique size may be obtained by adding to 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 has treewidth if and only if it has a haven of order but of no higher order, where a haven of order is a function that maps each set of at most vertices in into one of the connected components of and that obeys the monotonicity property that whenever .
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.
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.
The do not have bounded treewidth, because the grid graph is a planar graph with treewidth exactly . Therefore, if 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 , then there is a constant such that all graphs in have treewidth at most . That is, the following three conditions are equivalent to each other:.
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 is the treewidth and is the number of vertices of an input graph . Each of the algorithms outputs in time a decomposition of width given in the Approximation column. For example, the algorithm of in time either constructs a tree decomposition of the input graph of width at most or reports that the treewidth of is more than . Similarly, the algorithm of in time either constructs a tree decomposition of the input graph of width at most or reports that the treewidth of is more than . improved the width of the decomposition to in the same running time.
It is not known whether determining the treewidth of 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.
As an example, the problem of graph coloring a graph of treewidth may be solved by using a dynamic programming algorithm on a tree decomposition of the graph. For each bag of the tree decomposition, and each partition of the vertices of 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 -vertex graph in time , a time bound that makes this problem fixed-parameter tractable.
Consider for example the graph coloring for graphs. For a graph , this problem asks if it is possible to assign each vertex 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 where ,, represent the subsets of vertices having each of the three colors, and where the subexpressions are defined to mean (It is not necessary to include in this formula the requirement that the sets 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.
(For the notation in the lower bound, see big O notation.) 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.
It is also possible for a class of graphs that is not closed under minors to have bounded local treewidth. In particular this is trivially true for a class of bounded degree graphs, as bounded diameter subgraphs have bounded size. Another example is given by 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.
defines a class of graph parameters that he calls -functions, which include the treewidth. These functions from graphs to integers are required to be zero on [[graphs with no edges|empty graph]], to be [[minor-monotone|graph minor]] (a function is referred to as "minor-monotone" if, whenever is a minor of , one has ), to increase by one when a new vertex is added that is [[adjacent to all previous vertices|universal vertex]], and to take the larger value from the two subgraphs on either side of a clique [[separator|Vertex 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|complete graph]] [[minor|graph minor]] in the given graph.
|
|