Tree decompositions and treewidth #
A tree decomposition of a graph G on V is a tree T on an index type ι together with a
finite bag bag t ⊆ V for every node t, such that
- every vertex lies in some bag;
- both endpoints of every edge lie in a common bag;
- for every vertex
v, the nodes whose bags containvinduce a connected subtree ofT.
The width of a decomposition with finitely many nodes is the largest bag size minus one. The
treewidth of G is the least width of a decomposition with finitely many nodes.
We work with finite bags and finite index trees throughout. SimpleGraph.etreewidth takes values
in ℕ∞ and is ⊤ exactly when G has no such decomposition. Finitely many finite bags cover
only finitely many vertices, so this happens if and only if V is infinite, whatever the edges of
G (SimpleGraph.etreewidth_eq_top_iff). In particular ⊤ carries no graph information, and
etreewidth is not the treewidth of infinite graphs, which allows decompositions over infinite
trees. SimpleGraph.treewidth is the truncation to ℕ. It is the textbook treewidth for finite
V, where the single-bag decomposition shows treewidth G ≤ card V - 1. A graph on an empty
vertex type has treewidth 0.
Condition 3 is stated as preconnectedness of the induced subgraph, so a vertex lying in no bag would satisfy it vacuously; condition 1 rules that out.
Relation to open Mathlib pull requests #
Justin Lai's open pull request mathlib4#38334 defines the same structure, TreeDecomp, with the
same three axioms; mathlib4#39864 (the Helly property for subtrees) and mathlib4#39939 (complete
graphs and the clique bound) build on it. Here the index type is a
universe-polymorphic parameter ι rather than W : Type, and width is ℕ-valued on a
Fintype index. etreewidth minimizes over Fin n-indexed decompositions, so it is ⊤ exactly
for infinite V, whereas #38334 minimizes over all index types, giving the edgeless graph on ℕ
extended treewidth 0. The two agree for finite V. The rooted parent-array form
(TreeDecomposition/Rooted, SimpleGraph.parentTree, IsTree.parent), minDegree_le_treewidth,
treewidth_le_one_iff and treewidth_cycleGraph are additions on top of that work; the
topmost-node proof that a clique lies in a bag is an alternative to the Helly argument.
Upstreaming should follow that work rather than compete with it.
Main definitions #
SimpleGraph.TreeDecomposition G ι: a tree decomposition ofGindexed by a tree onι.SimpleGraph.TreeDecomposition.width: the largest bag size minus one.SimpleGraph.etreewidth,SimpleGraph.treewidth: extended and truncated treewidth.
Main results #
SimpleGraph.etreewidth_le_of_hom,SimpleGraph.treewidth_le_of_hom: treewidth does not increase along injective homomorphisms, in particular under taking subgraphs (SimpleGraph.treewidth_mono).SimpleGraph.Iso.treewidth_eq: treewidth is an isomorphism invariant.SimpleGraph.treewidth_le_card:treewidth G ≤ card V - 1.SimpleGraph.etreewidth_eq_top_iff:etreewidth G = ⊤ ↔ Infinite V.SimpleGraph.exists_width_eq_treewidth,SimpleGraph.le_treewidth_iff,SimpleGraph.treewidth_le_iff: treewidth is attained, and its order characterizations.
References #
A tree decomposition of G indexed by a tree on ι: finite bags of vertices at the nodes of
a tree, covering every vertex and every edge, such that the nodes whose bags contain a given vertex
induce a connected subtree.
- tree : SimpleGraph ι
The index tree.
The index graph is a tree.
- bag : ι → Finset V
The bag of vertices at each node.
Every vertex lies in some bag.
Both endpoints of every edge lie in a common bag.
The nodes whose bags contain a given vertex induce a connected subtree.
The width of a tree decomposition with finitely many nodes: the largest bag size minus one.
Finitely many finite bags cover the vertices, so a graph with a tree decomposition with finitely many nodes has a finite vertex type.
Transport a tree decomposition along an equivalence of index types.
Pull a tree decomposition of G back along an injective homomorphism H →g G: the bags are
the preimages of the bags.
The decomposition of a graph on a finite vertex type with a single bag containing every vertex.
Treewidth #
The extended treewidth of G: the least width of a tree decomposition of G with finitely
many nodes, or ⊤ if there is none. Nodes are indexed by Fin n, which loses no generality
(SimpleGraph.etreewidth_le_width).
Since finitely many finite bags cover only finitely many vertices, etreewidth G = ⊤ if and only
if V is infinite (SimpleGraph.etreewidth_eq_top_iff). So ⊤ carries no information about
the edges of G, and this is not the treewidth of infinite graphs, which allows decompositions
over infinite trees.
etreewidth G = ⊤ exactly when the vertex type is infinite, whatever the edges of G.
The treewidth of G: the least width of a tree decomposition of G with finitely many nodes.
This is meaningful for finite V, where such a decomposition always exists. For infinite V it is
the junk value 0 (see SimpleGraph.etreewidth_eq_top_iff). A graph on an empty vertex type has
treewidth 0 (one empty bag), not the value -1 used by some texts.
Treewidth does not increase along injective homomorphisms.
Treewidth does not increase along injective homomorphisms into a finite graph.
Treewidth is monotone under taking subgraphs.