Advanced Algorithms
Part 3. DP over trees and beyond
Part 1a. DP over Paths and Trees
Part 1b. Treewidth: Definition and Computation
Part 1c. MWIS over Bounded Treewidth
Part 1d. Dominating Set over Bounded Treewidth
Part 1e. Treewidth and monadic second-order logic
Advanced Algorithms
Part 3. DP over trees and beyond
Part 1a. DP over Paths and Trees
Part 1b. Treewidth: Definition and Computation
Part 1c. MWIS over Bounded Treewidth
Part 1d. Dominating Set over Bounded Treewidth
Part 1e. Treewidth and monadic second-order logic
Maximum Independent Set
Input: A graph G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A graph G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A graph G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A graph G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A graph G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A graph G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Definition.
A tree is a connected graph with no cycles.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Lemma. If T=(V,E) is a tree and v is a leaf of the tree, then
there exists a maximum-size independent set that contains v.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.
Definition.
A subset S⊆V is called an independent set if
for all u,v∈S, (u,v)∈/E.
Lemma. If T=(V,E) is a tree and v is a leaf of the tree, then
there exists a maximum-size independent set that contains v.
Maximum Independent Set
Input: A tree G=(V,E), and a positive integer k.
Task: Determine if G has an independent set of size at least k.

A Greedy Algorithm:
(source: Algorithm Design · Jon Kleinberg and Éva Tardos)
Maximum Weight Independent Set
Input: A tree G=(V,E), a weight function w:V→Q⩾0 and k∈Z+.
Task: Determine if G has an independent set of weight at least k.
...
Subproblems: DP[r] = solution size for subtree rooted at r.
Solution: DP[root(T)]
Base Case: DP[v] = w(v) for all leaves v.
How do you combine subproblems?
Maximum Weight Independent Set
Input: A tree G=(V,E), a weight function w:V→Q⩾0 and k∈Z+.
Task: Determine if G has an independent set of weight at least k.
...
Among all independent sets of H that contain the root, record the weight of the largest.
Among all independent sets of H that omit the root, record the weight of the largest.
Each independent set in H either contains the root, or omits it.
Maximum Weight Independent Set
Input: A tree G=(V,E), a weight function w:V→Q⩾0 and k∈Z+.
Task: Determine if G has an independent set of weight at least k.
...
Maximum Weight Independent Set
Input: A tree G=(V,E), a weight function w:V→Q⩾0 and k∈Z+.
Task: Determine if G has an independent set of weight at least k.
...
Maximum Weight Independent Set
Input: A tree G=(V,E), a weight function w:V→Q⩾0 and k∈Z+.
Task: Determine if G has an independent set of weight at least k.
...
Maximum Weight Independent Set
Input: A tree G=(V,E), a weight function w:V→Q⩾0 and k∈Z+.
Task: Determine if G has an independent set of weight at least k.
...
Maximum Weight Independent Set
Input: A tree G=(V,E), a weight function w:V→Q⩾0 and k∈Z+.
Task: Determine if G has an independent set of weight at least k.

Advanced Algorithms
Part 3. DP over trees and beyond
Part 1a. DP over Paths and Trees
Part 1b. Treewidth: Definition and Computation
Part 1c. MWIS over Bounded Treewidth
Part 1d. Dominating Set over Bounded Treewidth
Part 1e. Treewidth and monadic second-order logic
To solve Maximum-Weight Independent Set on a tree,
we took advantage of a special property of (rooted) trees:
Once we decide whether or not to include a node u in the independent set, the subproblems in each subtree become completely separated;
we can solve each as though the others did not exist.
In general graphs there might not be
a node that breaks the communication between subproblems
in the rest of the graph.
For the Independent Set Problem in general graphs,
decisions we make in one place seem to have complex repercussions all across the graph.
For how general a class of graphs can we use this notion of
limited interaction
(recursively chopping up the input using small sets of nodes)
to design efficient algorithms for a problem like
Maximum-Weight Independent Set?





















Tree Decomposition
Formally, a tree decomposition of G=(V,E) consists of a tree T (on a different node set from G ),
and a subset Vt⊆V associated with each node t of T.
We will call these subsets Vt the pieces or bags of the tree decomposition.
This is denoted as the ordered pair (T,{Vt:t∈T}).
Tree Decomposition
The tree T and the collection of pieces {Vt:t∈T} must satisfy the following:
(Node Coverage) Every node of G belongs to at least one piece Vt.
(Edge Coverage) For every edge e of G,
there is some piece Vt containing both ends of e.
(Coherence) Let t1,t2, and t3 be three nodes of T such that
t2 lies on the path from t1 to t3.
Then, if a node v of G belongs to both Vt1 and Vt3,
it also belongs to Vt2.
Tree Decomposition
What does a tree decomposition of a tree look like?


If we delete an edge e from a tree,
it falls apart into exactly two connected components.
If we delete a node t from a tree,
the tree falls apart into a number of components equal to the degree of t.
Useful Separation Properties of Trees
The Coherence Property is designed to guarantee that separations of T,
of both these types, correspond naturally to separations of G as well.
If T′ is a subgraph of T,
we use GT′ to denote the subgraph of G induced by the nodes in all pieces associated with nodes of T′,
that is, the set ∪t∈T′Vt.
Separations in Tree Decompositions
Lemma. Suppose that T−t has components T1,…,Td.
Then the subgraphs
GT1−Vt,GT2−Vt,…,GTd−Vt
have no nodes in common, and there are no edges between them.
Goal 1. The subgraphs GTi−Vt do not share any nodes.
Any such node v would need to belong to both
GTi−Vt and GTj−Vt for some i=j.
Such a node v belongs
to some piece Vx with x∈Ti, and
to some piece Vy with y∈Tj.
Since t lies on the x−y path in T,
it follows from the Coherence Property that v lies in Vt.
So v belongs to neither GTi−Vt nor GTj−Vt.
Goal 2. There is no edge (u,v) with u∈GTi−Vt and v∈GTj−Vt,
for some j=i.
There has to be some piece Vx containing both u and v.
Suppose x∈/Ti.
Then the node u belongs to both Vx and Vy.
Recall: u∈GTi−Vt.
...so u must be in a set Vy for some y in Ti.
Since t lies on the x−y path in T, it follows that u also belongs to Vt.
Therefore u does not lie in GTi−Vt, a contradiction.
(The other case is symmetric.)
If T′ is a subgraph of T,
we use GT′ to denote the subgraph of G induced by the nodes in all pieces associated with nodes of T′,
that is, the set ∪t∈T′Vt.
Separations in Tree Decompositions
Lemma. Let X and Y be the two components of T
after the deletion of the edge (x,y).
Then deleting the set Vx∩Vy from V disconnects G into the two subgraphs GX−(Vx∩Vy) and GY−(Vx∩Vy)
More precisely, these two subgraphs do not share any nodes, and there is no edge with one end in each of them.
GX−Vx∩Vy
GY−Vx∩Vy
Vx
Vy
Treewidth
Note: every graph has a tree decomposition.
(One bag and all vertices.)
Q. What tree decompositions are useful?
When the separations are small.
We define the width of a tree decomposition (T,{Vt}) to be one less than the maximum size of any piece Vt:
width (T,{Vt})=maxt∣Vt∣−1.
We then define the tree-width of G to be the minimum width of any tree decomposition of G.
Treewidth
Lemma. A connected graph G has tree-width 1
if and only if it is a tree.
Treewidth
Non-redundancy.
Treewidth
Non-redundancy.
Treewidth
Non-redundancy.
Treewidth
Can always ensure that there is no edge (x,y) of the underlying tree such that Vx⊆Vy.
Treewidth
Can always ensure that there is no edge (x,y) of the underlying tree such that Vx⊆Vy.
Lemma. Any nonredundant tree decomposition of an n-node graph has at most n pieces.
Treewidth
How do we determine the treewidth of a graph?
NP-complete to check if a graph has treewidth at most w.
Lemma. Given a graph G and a parameter w, there is an algorithm that does one of the following two things:
- it produces a tree decomposition of width less than 4w, or
- it reports (correctly) that G does not have tree-width less than w.
The running time of the algorithm is O(f(w)⋅mn),
for a function f(⋅) that depends only on w.
Advanced Algorithms
Part 3. DP over trees and beyond
Part 1a. DP over Paths and Trees
Part 1b. Treewidth: Definition and Computation
Part 1c. MWIS over Bounded Treewidth
Part 1d. Dominating Set over Bounded Treewidth
Part 1e. Treewidth and monadic second-order logic
Input. A graph G=(V,E), a weight function w:V→Q⩾0, and a tree decomposition T;{Vt} of width w.
Task. Find a maximum-weight independent subset of G.
Root the tree T at a node r.
For any node t, let Tt denote the subtree rooted at t.
Recall that GTt denotes the subgraph of G induced by the nodes in all pieces associated with nodes of Tt.
For a subset U of V, w(U)=∑u∈Uwu.
For notational simplicity, we will also write this subgraph as Gt.
Input. A graph G=(V,E), a weight function w:V→Q⩾0, and a tree decomposition T;{Vt} of width w.
Task. Find a maximum-weight independent subset of G.
We define a set of subproblems for each subtree Tt, one corresponding to each possible subset U of Vt that may represent the intersection of the optimal solution with Vt.
Vt
For each independent set U⊆Vt, we write ft(U) to denote the maximum weight of an independent set S in Gt, subject to the requirement that S∩Vt=U.
Input. A graph G=(V,E), a weight function w:V→Q⩾0, and a tree decomposition T;{Vt} of width w.
Task. Find a maximum-weight independent subset of G.
We define a set of subproblems for each subtree Tt, one corresponding to each possible subset U of Vt that may represent the intersection of the optimal solution with Vt.
Vt
2w subproblems associated with each node.
Final answer: take the best solution among all subsets of the root.
Vt
Gt
Vt
Gt1
Gtk
Vt1
Vtk
…
…
The value of ft(U) is given by the following recurrence:
ft(U)=w(U)+i=1∑dmax{fti(Ui)−w(Ui∩U):Ui∩Vt=U∩Vti and Ui⊆Vti is independent }.
The Recurrence
The value of ft(U) is given by the following recurrence:
ft(U)=w(U)+i=1∑dmax{fti(Ui)−w(Ui∩U):Ui∩Vt=U∩Vti and Ui⊆Vti is independent }.
The Recurrence
The value of ft(U) is given by the following recurrence:
ft(U)=w(U)+i=1∑dmax{fti(Ui)−w(Ui∩U):Ui∩Vt=U∩Vti and Ui⊆Vti is independent }.
The Recurrence
The value of ft(U) is given by the following recurrence:
ft(U)=w(U)+i=1∑dmax{fti(Ui)−w(Ui∩U):Ui∩Vt=U∩Vti and Ui⊆Vti is independent }.
The Recurrence
For a leaf t,
ft(U) is given by w(U)
if U is an independent subset of Vt,
and is not defined otherwise.
Base Cases
Advanced Algorithms
Part 3. DP over trees and beyond
Part 1a. DP over Paths and Trees
Part 1b. Treewidth: Definition and Computation
Part 1c. MWIS over Bounded Treewidth
Part 1d. Dominating Set over Bounded Treewidth
Part 1e. Treewidth and monadic second-order logic
Nice Tree Decompositions
All leaves are empty.
Every node is either
an introduce vertex node, an introduce edge node,
a forget node, or a join node.
Nice Tree Decompositions
All leaves are empty.
Every node is either
an introduce vertex node, an introduce edge node,
a forget node, or a join node.
Xt′
Xt:=Xt′∪{v}
Nice Tree Decompositions
All leaves are empty.
Every node is either
an introduce vertex node, an introduce edge node,
a forget node, or a join node.
Xt′
Xt:=Xt′∖{v}
Nice Tree Decompositions
All leaves are empty.
Every node is either
an introduce vertex node, an introduce edge node,
a forget node, or a join node.
Xp
Xq
Xt=Xp=Xq
Nice Tree Decompositions
All leaves are empty.
Every node is either
an introduce vertex node, an introduce edge node,
a forget node, or a join node.
From tree decompositions to graphs
Gt=(Vt,Et={e:e is introduced in the subtree rooted at t}).
Vt:=∪t′ child of tVt′.
Treewidth DP for minimum dominating set
A set of vertices D is a dominating set in graph G if V(G)=N[D].
The goal is to provide a dynamic-programming algorithm on a tree decomposition that determines the minimum possible size of a dominating set of the input graph G.
Treewidth DP for minimum dominating set
A set of vertices D is a dominating set in graph G if V(G)=N[D].
The goal is to provide a dynamic-programming algorithm on a tree decomposition that determines the minimum possible size of a dominating set of the input graph G.
Note: the complement of any maximal independent set
is a dominating set.
A coloring of bag Xt is a mapping
f:Xt→{0,0^,1}
assigning three different colors to vertices of the bag.
Black, represented by 1 .
The meaning is that all black vertices have to be contained in the partial solution in Gt.
White, represented by 0 .
The meaning is that all white vertices are not contained in the partial solution and must be dominated by it.
Grey, represented by 0^.
The meaning is that all grey vertices are not contained in the partial solution, but do not have to be dominated by it.
For a node t, there are 3∣Xt∣ colorings of Xt;
these colorings form the space of states at node t.
For a coloring f of Xt, we denote by c[t,f] the minimum size of a set D⊆Vt such that:
(a) D∩Xt=f−1(1), which is the set of vertices of Xt colored black.
(b) Every vertex of Vt\f−1(0^) either is in D or is adjacent in Gt to a vertex of D. That is, D dominates all vertices of Vt in graph Gt, except possibly some grey vertices in Xt.
Introduce Node
Xt′
Xt:=Xt′∪{v}
c[t,f]=⎩⎨⎧+∞c[t′,f∣Xt′]1+c[t′,f∣Xt′] when f(v)=0 when f(v)=0^ when f(v)=1
Introduce Edge Node
c[t,f]=⎩⎨⎧c[t′,fv→0]c[t′,fu→0]c[t′,f] when (f(u),f(v))=(1,0), when (f(u),f(v))=(0,1), otherwise.
Forget Node
Xt′
Xt:=Xt′∖{v}
c[t,f]=min{c[t′,fw→1],c[t′,fw→0]}.
Join Node
Xp
Xq
Xt=Xp=Xq
c[t,f]=minf1,f2{c[t1,f1]+c[t2,f2]−f−1(1)}
Advanced Algorithms
Part 3. DP over trees and beyond
Part 1a. DP over Paths and Trees
Part 1b. Treewidth: Definition and Computation
Part 1c. MWIS over Bounded Treewidth
Part 1d. Dominating Set over Bounded Treewidth
Part 1e. Treewidth and monadic second-order logic
conn(X)=∀Y⊆V[(∃u∈Xu∈Y∧∃v∈Xv∈/Y)⇒(∃e∈E∃u∈X∃v∈Xinc(u,e)∧inc(v,e)∧u∈Y∧v∈/Y)].
AdvAlgo 03
By Neeldhara Misra
AdvAlgo 03
- 439