Introduction to Treewidth
Marcin Pilipczuk most slides by Łukasz Kowalik
some slides by Marek Cygan and Michał Pilipczuk
Algorytmika, 11.05.2020r.
Treewidth
The book
Contained in Chapter 7 of
http://parameterized-algorithms.mimuw.edu.pl
Motivation of treewidth
Independent Set: given a graph with vertex weights, find the maximum weight of a subset of vertices that are pairwise non-adjacent.
NP-hard in general, tractable in many special cases. Easy exercise: linear-time algorithm on trees.
I Principle of dynamic programming.
Motivation of treewidth
Independent Set: given a graph with vertex weights, find the maximum weight of a subset of vertices that are pairwise non-adjacent.
NP-hard in general, tractable in many special cases.
Easy exercise: linear-time algorithm on trees.
I Principle of dynamic programming.
Motivation of treewidth
Independent Set: given a graph with vertex weights, find the maximum weight of a subset of vertices that are pairwise non-adjacent.
NP-hard in general, tractable in many special cases.
Easy exercise: linear-time algorithm on trees.
I Principle of dynamic programming.
Motivation of treewidth
Independent Set: given a graph with vertex weights, find the maximum weight of a subset of vertices that are pairwise non-adjacent.
NP-hard in general, tractable in many special cases.
Easy exercise: linear-time algorithm on trees.
I Principle of dynamic programming.
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u. Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ]. u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u. Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u. Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u. Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ]. Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ]. Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ]. Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ].
u
Weighted Independent Set on trees
Root the tree in an arbitrary vertex r .
I Tu is the subtree rooted at u.
Compute dynamic programming tables:
I A[u]: maximum weight of an IS in Tu.
I B[u]: maximum weight of an IS in Tu that contains u.
I C [u]: maximum weight of an IS in Tu that excludes u.
Recursive formulas:
I A[u] = max(B[u], C [u]).
I B[u] = w (u) +P
v ∈chld(u)C [v ].
I C [u] =P
v ∈chld(u)A[v ].
Answer: A[r ]. u
Independent Set on trees: Why does the DP work?
Very limited dependence between vertices
Essential information about subtree stored in a compact way.
u
Generalizations of paths and trees
pathlike path
Pathwidth
Graph of small pathwidth is path-like.
We hope that problems tractable on paths are also tractable on graphs of small pathwidth.
Generalizations of paths and trees
tree treelike
Treewidth
Graph of small treewidth is tree-like.
We hope that problems tractable on trees are also tractable on graphs of small treewidth.
Generalizations of paths and trees
treelike tree
Treewidth
Graph of small treewidth is tree-like.
We hope that problems tractable on trees are also tractable on graphs of small treewidth.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Introduction
Crucial property of small pathwidth/treewidth graphs: separators.
Definition (mapping to intervals)
Definition
A graph G has pathwidth ≤ pw if there exists a function f : V → intervals such that:
1 if (u, v ) ∈ E then f (u) ∩ f (v ) 6= ∅
2 ∀x ∈Z|{v ∈ V : x ∈ f (v )}| ≤ pw + 1
v2 v3 v4 v5 v1
f (v1) f (v2) f (v4)
f (v3) f (v5)
Definition (mapping to intervals)
Definition
A graph G has pathwidth ≤ pw if there exists a function f : V → intervals such that:
1 if (u, v ) ∈ E then f (u) ∩ f (v ) 6= ∅
2 ∀x ∈Z|{v ∈ V : x ∈ f (v )}| ≤ pw + 1
v2 v3 v4 v5 v1
f (v1) f (v2) f (v4)
f (v3) f (v5)
Definition (mapping to intervals)
Definition
A graph G has pathwidth ≤ pw if there exists a function f : V → intervals such that:
1 if (u, v ) ∈ E then f (u) ∩ f (v ) 6= ∅
2 ∀x ∈Z|{v ∈ V : x ∈ f (v )}| ≤ pw + 1
v2 v3 v4 v5 v1
f (v1) f (v2) f (v4)
f (v3) f (v5)
Definition (mapping to intervals)
Definition
A graph G has pathwidth ≤ pw if there exists a function f : V → intervals such that:
1 if (u, v ) ∈ E then f (u) ∩ f (v ) 6= ∅
2 ∀x ∈Z|{v ∈ V : x ∈ f (v )}| ≤ pw + 1
v2 v3 v4 v5 v1
f (v1) f (v2) f (v4)
f (v3) f (v5)
Path decompositions and pathwidth
Graph G = (V , E ) Path decomposition of G
c b
a
f e d
i h g
abdef bcdef defgh efhi
Path decomposition is a path of bags (subsets of V )
such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subpath (connected!)
Width of the decomposition: maximum bag size −1 (here: 4). Pathwidth of G: minimum width of a decomposition of G .
Path decompositions and pathwidth
Graph G = (V , E ) Path decomposition of G
c b
a
f e d
i h g
abdef bcdef defgh efhi
Path decomposition is a path of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subpath (connected!)
Width of the decomposition: maximum bag size −1 (here: 4). Pathwidth of G: minimum width of a decomposition of G .
Path decompositions and pathwidth
Graph G = (V , E ) Path decomposition of G
c b
a
f e d d
i h g
abdef bcdef defgh efhi
abdef bcdef defgh efhi
Path decomposition is a path of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subpath (connected!)
Width of the decomposition: maximum bag size −1 (here: 4). Pathwidth of G: minimum width of a decomposition of G .
Path decompositions and pathwidth
Graph G = (V , E ) Path decomposition of G
c b
a
f e d
i h g
abdef bcdef defgh efhi
Path decomposition is a path of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subpath (connected!)
Width of the decomposition: maximum bag size −1 (here: 4).
Pathwidth of G: minimum width of a decomposition of G .
Nice path decomposition
Graph G = (V , E ) Path decomposition of G
c b
a
f e d
i h
g ∅ a ab abd abde abdef bdef
bcdef bdef def defg defgh efgh
efh efhi efh ef e ∅
Nice path decomposition is a path decomposition X1, . . . , Xr such that X1 = Xr = ∅
For i = 2, . . . , r bag Xi is of one of two types:
1 Introduce bag: Xi= Xi −1∪ {v } for some v ∈ V \ Xi −1,
2 Forget bag: Xi= Xi −1\ {v } for some v ∈ Xi −1.
(Easy) Theorem 1: Graph has a path decomposition of width w iff it has a nice path decomposition of width w (at most 2w times longer).
Nice path decomposition
Graph G = (V , E ) Path decomposition of G
c b
a
f e d
i h
g ∅ a ab abd abde abdef bdef
bcdef bdef def defg defgh efgh
efh efhi efh ef e ∅
Nice path decomposition is a path decomposition X1, . . . , Xr such that X1 = Xr = ∅
For i = 2, . . . , r bag Xi is of one of two types:
1 Introduce bag: Xi= Xi −1∪ {v } for some v ∈ V \ Xi −1,
2 Forget bag: Xi= Xi −1\ {v } for some v ∈ Xi −1.
(Easy) Theorem 2: There is a mapping of G to p intervals iff G has nice path decomposition with bags of size p.
Dynamic programming for Independent Set
For every node t of a path decomposition of graph G : Xt = the bag at t,
Vt =S
i ≤tXi
X1 Vt · · · Xt
Theorem
The bag Xi is a separator between Vi \ Xi and V (G ) \ Vi.
If S is an independent set in G and S0 is an independent set in G [Vi] with S0∩ Xi = S ∩ Xi, then (S \ Vi) ∪ S0 is an independent set as well.
Dynamic programming for Independent Set
For every node t of a path decomposition of graph G : Xt = the bag at t,
Vt =S
i ≤tXi
X1 Vt · · · Xt
Theorem
The bag Xi is a separator between Vi \ Xi and V (G ) \ Vi.
If S is an independent set in G and S0 is an independent set in G [Vi] with S0∩ Xi = S ∩ Xi, then (S \ Vi) ∪ S0 is an independent set as well.
Dynamic programming for Independent Set
For every node t of a path decomposition of graph G : Xt = the bag at t,
Vt =S
i ≤tXi
X1 Vt · · · Xt
Theorem
The bag Xi is a separator between Vi \ Xi and V (G ) \ Vi.
If S is an independent set in G and S0 is an independent set in G [Vi] with S0∩ Xi = S ∩ Xi, then (S \ Vi) ∪ S0 is an independent set as well.
Dynamic programming for Independent Set
For every node t of a path decomposition of graph G : Xt = the bag at t,
Vt =S
i ≤tXi
X1 Vt · · · Xt
For every f : Xi → {0, 1} we want to compute the following.
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
We now give recursive equations on Ψ[·, ·].
Ψ[i , ∅] = 0 if i = 1. The answer is Ψ[r , ∅].
We follow convention that Ψ[i , f ] = −∞ if f−1(1) is already not independent.
Dynamic programming for Independent Set
For every node t of a path decomposition of graph G : Xt = the bag at t,
Vt =S
i ≤tXi
X1 Vt · · · Xt
For every f : Xi → {0, 1} we want to compute the following.
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
We now give recursive equations on Ψ[·, ·].
Ψ[i , ∅] = 0 if i = 1.
The answer is Ψ[r , ∅].
We follow convention that Ψ[i , f ] = −∞ if f−1(1) is already not independent.
Dynamic programming for Independent Set
For every node t of a path decomposition of graph G : Xt = the bag at t,
Vt =S
i ≤tXi
X1 Vt · · · Xt
For every f : Xi → {0, 1} we want to compute the following.
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
We now give recursive equations on Ψ[·, ·].
Ψ[i , ∅] = 0 if i = 1.
The answer is Ψ[r , ∅].
We follow convention that Ψ[i , f ] = −∞ if f−1(1) is already not independent.
Dynamic programming for Independent Set
For every node t of a path decomposition of graph G : Xt = the bag at t,
Vt =S
i ≤tXi
X1 Vt · · · Xt
For every f : Xi → {0, 1} we want to compute the following.
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
We now give recursive equations on Ψ[·, ·].
Ψ[i , ∅] = 0 if i = 1.
The answer is Ψ[r , ∅].
We follow convention that Ψ[i , f ] = −∞ if f−1(1) is already not independent.
DP for Independent Set: introduce node
Introduce node i such that Xi = Xi −1∪ {v }.
Goal: For f : Xi → {0, 1} compute
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}. If f (v ) = 0 then
Ψ[i , f ] = Ψ[i − 1, f |Xi −1].
If f (v ) = 1 and there is v0 ∈ Xi s.t. vv0∈ E (G ) and f (v0) = 1, then Ψ[i , f ] = −∞.
Otherwise, we have
Ψ[i , f ] = 1 + Ψ[i − 1, f |Xi −1].
DP for Independent Set: introduce node
Introduce node i such that Xi = Xi −1∪ {v }.
Goal: For f : Xi → {0, 1} compute
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
If f (v ) = 0 then
Ψ[i , f ] = Ψ[i − 1, f |Xi −1].
If f (v ) = 1 and there is v0 ∈ Xi s.t. vv0∈ E (G ) and f (v0) = 1, then Ψ[i , f ] = −∞.
Otherwise, we have
Ψ[i , f ] = 1 + Ψ[i − 1, f |Xi −1].
DP for Independent Set: introduce node
Introduce node i such that Xi = Xi −1∪ {v }.
Goal: For f : Xi → {0, 1} compute
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
If f (v ) = 0 then
Ψ[i , f ] = Ψ[i − 1, f |Xi −1].
If f (v ) = 1 and there is v0 ∈ Xi s.t. vv0∈ E (G ) and f (v0) = 1, then Ψ[i , f ] = −∞.
Otherwise, we have
Ψ[i , f ] = 1 + Ψ[i − 1, f |Xi −1].
DP for Independent Set: forget node
Forget node i such that Xi = Xi −1\ {v }.
Goal: For f : Xi → {0, 1} compute
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
Ψ[i , f ] = max(Ψ[i − 1, f [v → 0]], Ψ[i − 1, f [v → 1]]).
There is no need to check edges, since we have already checked them at introduce nodes. That is, even if there is u ∈ Xi such that vu ∈ E (G ) and f (u) = 1, then
Ψ[i − 1, f [v → 1]] = −∞ and the above recursion reduces to
Ψ[i , f ] = Ψ[i − 1, f [v → 0]].
DP for Independent Set: forget node
Forget node i such that Xi = Xi −1\ {v }.
Goal: For f : Xi → {0, 1} compute
Ψ[i , f ] = max{|S | : S is an independent set in Vi and S ∩ Xi = f−1(1)}.
Ψ[i , f ] = max(Ψ[i − 1, f [v → 0]], Ψ[i − 1, f [v → 1]]).
There is no need to check edges, since we have already checked them at introduce nodes. That is, even if there is u ∈ Xi such that vu ∈ E (G ) and f (u) = 1, then
Ψ[i − 1, f [v → 1]] = −∞
and the above recursion reduces to
Ψ[i , f ] = Ψ[i − 1, f [v → 0]].
DP for Independent Set: conclusion for pathwidth
Theorem
Given an n-vertex graph and its path decomposition of width p, Independent Set can be solved in time 2pnO(1)pO(1).
Tree decompositions and treewidth
Graph G = (V , E ) Tree decomposition of G
c b
a
f e d
i h g
bdef defh abde
bcf
dhge
ehfi
Tree decomposition is a tree of bags (subsets of V )
such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subtree (connected!)
Width of the decomposition: maximum bag size −1 (here: 3). Treewidth of G: minimum width of a decomposition of G .
Tree decompositions and treewidth
Graph G = (V , E ) Tree decomposition of G
c b
a
f e d
i h g
bdef defh abde
bcf
dhge
ehfi
Tree decomposition is a tree of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subtree (connected!)
Width of the decomposition: maximum bag size −1 (here: 3). Treewidth of G: minimum width of a decomposition of G .
Tree decompositions and treewidth
Graph G = (V , E ) Tree decomposition of G
c b
a
f e d
i h g
bdef defh abde
bcf
dhge
ehfi bdef defh
abde dhge
ehfi
Tree decomposition is a tree of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subtree (connected!)
Width of the decomposition: maximum bag size −1 (here: 3). Treewidth of G: minimum width of a decomposition of G .
Tree decompositions and treewidth
Graph G = (V , E ) Tree decomposition of G
c b
a
f e d
i h g
bdef defh abde
bcf
dhge
ehfi defh
dhge
ehfi
Tree decomposition is a tree of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subtree (connected!)
Width of the decomposition: maximum bag size −1 (here: 3). Treewidth of G: minimum width of a decomposition of G .
Tree decompositions and treewidth
Graph G = (V , E ) Tree decomposition of G
c b
a
f e d
i h g
bdef defh abde
bcf
dhge
ehfi abde
Tree decomposition is a tree of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subtree (connected!)
Width of the decomposition: maximum bag size −1 (here: 3). Treewidth of G: minimum width of a decomposition of G .
Tree decompositions and treewidth
Graph G = (V , E ) Tree decomposition of G
c b
a
f e d
i h g
bdef defh abde
bcf
dhge
ehfi
Tree decomposition is a tree of bags (subsets of V ) such that For every edge uv ∈ E some bag contains u and v
For every vertex v ∈ V bags containing v form nonempty subtree (connected!)
Width of the decomposition: maximum bag size −1 (here: 3).
Treewidth of G: minimum width of a decomposition of G .
Tree decompositions and treewidth
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Tree decomposition: Tree of bags
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T1: Every vertex is in some bag
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T2: Every edge is in some bag
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T3: Bags containing a vertex are connected
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Width of decomposition: Maximum bag size minus 1 Treewidth: Minimum width of a tree decomposition Property: Edge of decomposition induces a separation
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Tree decompositions and treewidth
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Tree decomposition: Tree of bags
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T1: Every vertex is in some bag
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T2: Every edge is in some bag
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T3: Bags containing a vertex are connected
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Width of decomposition: Maximum bag size minus 1 Treewidth: Minimum width of a tree decomposition Property: Edge of decomposition induces a separation
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Tree decompositions and treewidth
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Tree decomposition: Tree of bags
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T1: Every vertex is in some bag
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T2: Every edge is in some bag
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
T3: Bags containing a vertex are connected
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r
Width of decomposition: Maximum bag size minus 1 Treewidth: Minimum width of a tree decomposition Property: Edge of decomposition induces a separation
a
k b e
l c f h
d
g i
q s w
m o
u n
r v
p
z
a, b
e, h, k
n, o, r
v , z b, c, e
c, d
e, f , h
h, k, l
f , g , h, i g , i , s
i , s, w g , q, s
q, s, u r , u, v q, r , u o, q, r m, n, o
n, p, r