ArticleslgStudy

science

Treewidth

Treewidth is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Treewidth rather than just read about it. In short: 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.

Treewidth — main illustration
Treewidth — illustration

Key takeaways

  • Treewidth belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Treewidth to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Treewidth from memory before moving on to harder problems.

Reference excerpt

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 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.

Definition

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 X1,…Xt must satisfy the following properties:

Each graph vertex is contained in at least one bag: ⋃iXi=V If bags Xi and Xj both contain a vertex v, then all bags Xk associated with nodes in the (unique) path of T between Xi and Xj also contain v as well. Equivalently, the bags containing vertex v are associated with a connected subtree of T. For every edge (v,w) in the graph, there is at least one bag Xi 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 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 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 β that maps each set X of at most k vertices in G into one of the connected components of G∖Xand 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.

Examples 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 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×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.

Forbidden minors

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.

… excerpt ends here. Continue reading the full article.

Illustrations

Treewidth: A bramble of order four in a 3×3 grid graph, the existence of which shows that the graph has treewidth at least 3
A bramble of order four in a 3×3 grid graph, the existence of which shows that the graph has treewidth at least 3
Treewidth: The four forbidden minors for treewidth 3: K5 (top-left), the graph of the octahedron (bottom-left), the Wagner graph (top-right), and the graph of the pentagonal prism (bottom-right)
The four forbidden minors for treewidth 3: K5 (top-left), the graph of the octahedron (bottom-left), the Wagner graph (top-right), and the graph of the pentagonal prism (bottom-right)

Worked examples

Example 1 — a first encounter with Treewidth

Start with the simplest possible case. Write down what Treewidth claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Treewidth before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Treewidth ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Treewidth

In research
Treewidth appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Treewidth in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Treewidth is common in secondary-school and first-year university syllabi. It links to neighbouring topics Graph invariants, Graph minor theory, NP-complete problems, so understanding it makes those chapters shorter.
In everyday life
Look for Treewidth outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Treewidth” →

How to study Treewidth in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Treewidth means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Treewidth out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Treewidth in simple terms?

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.

Why does Treewidth matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Treewidth?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Treewidth.

Tags

  • Graph invariants
  • Graph minor theory
  • NP-complete problems

Keep exploring