37
AN INTRODUCTION TO TREEWIDTH Daniel Lokshtanov, UCSD

A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

Embed Size (px)

Citation preview

Page 1: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

AN INTRODUCTION TO TREEWIDTHDaniel Lokshtanov, UCSD

Page 2: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

WHAT IS TREEWIDTH?

A graph parameter that measures how close a graph is to being a tree.

Graphs with constant treewidth share many properties with trees, this can be exploited algorithmically For polynomial time algorithms (ex; minor

testing) Faster Exponential Time Algorithms for hard

problems Space-Bounded Computation Parameterized Algorithms Approximation Algorithms Preprocessing Heuristics (Kernelization)

Page 3: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

ORIGINS

Discovered independently in several fields; graph grammars, graph minors, logic.

Several different names in the 80’s. The ones i remember are Treewidth and partial k-trees.

Generalized to digraphs, hypergraphs, matroids ... here; only undirected graphs.

Page 4: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

EVERYTHING IS EASY ON TREES

Independent Set (ISET):

IN: Graph G, integer k.Q: Does G have a vertex set S of size k such

that every pair of vertices in S are non-adjacent?

NP-Complete in general, but linear time for trees. Why?

Page 5: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

DYNAMIC PROGRAMMING FOR ISET ON TREES

Root the tree T at rLet Tv be the subtree of T rooted at r

In[v] = Largest iset S in Tv such that v ∈ S.

Out[v] = Largest iset S in Tv such that v ∉ S.

Best[v] = Largest iset in Tv.

In[v] = Σu Out[u]

Out[v] = Σu Best[u]

Best[v]=max{In[v], Out[v]}

Page 6: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

GENERALIZE TREES?

Dynamic Programming works because the information must transfer through a single vertex.

Generalize to information transfer through a constant number of vertices.

Tree-Partition

Width = 3

Page 7: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

MORE GENERAL DYNAMIC PROGRAMMING

G = graph T = decomposition tree. For each node v

of T there is a bag Bv that contains vertices of G.

The bags of T partition the vertices of G. Root the tree T, Tv is the subtree rooted

at T. Gv is G[∪u∈ Tv Bu]

Page 8: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

ISET ON TREE-PARTITIONS

Define Best[v,S] where v is a node in T and S ⊆ Bv to be the size of the largest independent set X of Gv such that X ∩ Bv = S.

Test[X] = 1 if G[X] is independent, -∞ if not.

Best[v,S] = |S| + Σu MaxS’⊆Bu × Test[S ∪

S’]

Page 9: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

ARE TREE-PARTITIONS THE RIGHT GENERALIZATION?

What is the tree-partition-width?Decomposition tree must be a star with the

bag B containing u in the center.At least one component of size ≥ n/|B|tree-partition-width ≥ n1/2

u

vnv1 v2v3 vn-2 vn-1

Page 10: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

TOWARDS TREE-WIDTH

Need to make tree-partitions more robust; adding a new vertex should increase the ”width” by at most one, retaining nice algorithmic properties.

What if every vertex could appear several times, but every edge only needed to appear once?

Problem: Can decompose anything as a path!u v

y

xu v

uy

ux

y

x

vx

v

y

Page 11: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

TREE-DECOMPOSITION DEFINITION

A tree-decomposition of a graph G=(V,E) is a tree T and a collection X of bags, with a bag Ba ∈ X for every node a ∈ T, such that:

1. For every uv ∈ E, some bag contains both u and v

2. For every vertex v ∈ V, v appears in a non-empty, connected subtree of T.

The width of the decomposition is max |Bv| - 1

The treewidth of G is the smallest width over any decomposition.

Treewidth is NP-complete (Yannakakis)

Page 12: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

EXAMPLE

Treewidth of trees is 1

1

2 3

74

6

59

8c

b

a

{2} {3}{8,a}

Page 13: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

CONNECTIVITY PROPERTIES:

Lemma: Let (T,X) be a tree-decomposition of G, and let e=ab be an edge in T, splitting T into T1 and T2. Set V1 = ∪v ∈ T1

Bv and V2 = ∪v ∈

T2 Bv. Then,

V1 ∩ V2 = Ba ∩ Bb and there are no edges between V1 \ (Ba ∩ Bb) and V2 \ (Ba ∩ Bb ).

T1 T2

a b

V1V2

uu

u u

v

uv

Page 14: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

MORAL OF PREVIOUS SLIDE

For a node v of T, G \ Bv splits into components corresponding to the components of T \ v.

Page 15: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

EXERCISE

Prove that ISET can be solved in time O(4wpoly(n)) if a tree-decomposition (T,X) of width ≤ w is given.

Hint: Root the decoposition tree T at a vertex r. Define Tv to be the subtree below v, and Vv to be ∪u∈ Tv Bu.

Page 16: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

SOLUTION

Define Best[v,S] (where S ⊆ Bv) and G[S] is an iset, to be the size of the largest independent set X in G[Vv] such that X ∩ Bv = S.

Best[v,S] = |S| + Max Best[u,S’]-|S∩ Bu|S ∩ Bu ⊆ S’ S’ ⊆ S ∪ (Bu \ Bv)S ∪ S’ is an iset.

Σu

Children of v

Page 17: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

STRUCTURAL PROPERTIES

Page 18: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

ADDING / DELETING VERTICES

Lemma: (a) Adding a vertex v to G increases tw(G) by at most 1. (b) Deleting a vertex v from G can not increase tw(G).

Proof (a): Add v to all bags.Proof (b): Delete v from all bags it appears in.

Corollary: (a) Adding an edge e to G increases tw(G) by at most 1. (b) Deleting an edge e from G can not increase tw(G).

Page 19: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

EXERCISE

Show that treewidth of graph below is ≤ 2.

u

vnv1 v2v3 vn-2 vn-1

Proof:G \ u is a tree, hence of treewidth 1. Removing u decreased treewidth by at most 1.

Page 20: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

CONTRACTING AND SUBDIVIDING EDGES

Contracting an edge uv in G can not increase tw(G).

Proof: Replace all occurences of u and v by the new vertex ”uv”. Since some bag contained u and v, all is well.

Subdividing an edge uv can not increase tw(G).

Proof: Some bag contains uv. Add a new bag to it.

Page 21: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

TREEWIDTH OF CLIQUES

Lemma: In a tree-decomposition of a clique C, all of C must appear in some bag.

Proof: (Board for figure)Suppose not. Root the decomposition at a node

a that maximizes |Ba ∩ C| (of course, |Ba ∩ C| < |C|).

Let u ∈ C and u ∉ Ba. Let b be the topmost bag where u is.

Some v ∈ Ba ∩ C is not in Bb ∩ C.

Now uv can’t be in any bag!

Page 22: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

EXERCISE

Prove that a graph G has treewidth ≤ 1 if and only if it is a forest (contains no cycles)

Soln: Trees have treewidth 1 so forests do to. If G contains a cycle Cn then tw(G) ≥ tw(Cn) because deleting vertices does not increase treewidth. tw(Cn)≥ tw(C3) because contracting edges does not increase tw. tw(C3)=2.

Page 23: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

BALANCED SEPARATORS

Lemma: Let G be a graph of treewidth t, and X ⊆ V. There exists a set S of size at most t+1 such that for every connected component C of G\S, |C ∩ X| ≤ |X|/2. (*)

Proof: Root the tree at a node set p initially to be the root. While there is a child q of p such that |Vq ∩ X| > |X|/2, set p=q.

Page 24: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

BALANCED SEPARATORD CONT’D

When the algorithm terminates, the subtrees of all children satisfy |C ∩ X| ≤ |X|/2. If p has a parent then |Vp ∩ X| > |X/2| (since the parent wasn’t chosen) so the component C = G \ Tv satisfies |C ∩ X| ≤ |X/2|.

p

> |X|/2

≤ |X|/2

≤ |X|/2

Page 25: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

BALANCED SEPARATORS 2: EXERCISE

Lemma: For a graph G=(V,E) of treewidth t and a vertex set X, there is a partition of V into L ∪ S ∪ R such that: |S| ≤ t+1 There are no edges from L to R max{|L ∩ X|, |R ∩ X|} < 3|X|/4

Hint: Use previous Lemma + bin packing arguments.

Page 26: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

SOLN.

Find a set S of size t+1 such that all components C of G \ S satisfy |C ∩ X| ≤ |X|/2. Let C1 and C2 be the components with largest intersection with X. Put C1 into L, C2 into R, and place the remaining componetns into L or R if they fit.

At most one component C, does not fit.

wlog: |L ∩ X| ≤ |X-C|/2 so: |(L ∪ C) ∩ X| ≤ |X+C|/2 ≤ 2|X|/3

C fits into L if |(L ∪ C) ∩ X| ≤ |X|/2

If two components Ca and Cb

don’t fit then the smallest of themfits into the smallest of L and R.

Page 27: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

ISET IN POLYNOMIAL SPACE

Theorem: Independent set in graphs of treewidth t can be solved in time nO(t) and using polynomial space.

Proof: Find partition of G into L, R and S as described, using X=V. Guess the intersection of solution with S. Solve for L and R recursively.

T(n) ≤ 2t × 2T(2n/3) ≤ 2t × log3/2 n ≤ nO(t)

Page 28: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

WHAT ABOUT ISET IN F(TW)NO(1) TIME AND POLYNOMIAL SPACE?

Theorem: Independent Set in graphs of treewidth t can be solved in time 2O(t2)nO(1) and using polynomial space.

Proof: If n ≥ 2t then the 4tnO(1), 2tnO(1) space DP

algorithm runs in polynomial space.

If n ≤ 2t then nO(t) ≤ (2t)O(t) ≤ 2O(t2)nO(1).

Page 29: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

COMPUTING TREEWIDTH

Theorem: [Bodlaender, early 90’s]: The treewidth of G can be computed in time 2O(t3)n.

Page 30: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

WHAT TO OPTIMIZE?

For algorithms on graphs on bounded treewidth one can try to optimize the dependence on t, or the dependence on n.

For the dependence on n, Courcelle’s theorem gives very strong results.

Page 31: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

(C)MSOL

Quantifiers: ∃ and ∀ for variables for vertex sets and edge sets, vertices and edges.

Operators: = and ∊Operators: inc(v,e) and adj(u,v) Logical operators: ∧, ∨ and ¬(C): Size modulo fixed integers operator:

eqmodp,q(S)

EXAMPLE: p(G,S) = “S is an independent set of G”:p(G,S) = ∀u, v ∊ S, ¬adj(u,v)

Page 32: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

CMSOL OPTIMIZATION PROBLEMSFOR COLORED GRAPHS

Φ-OptimizationInput: G, C1, ... Cx

Max / Min |S|So that Φ(G, C1, Cx, S) holds.

CMSOL definable proposition

Page 33: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

MODEL CHECKING CMSOL PROPERTIES

Φ-Model-Checking:IN: G, C1, ... Cx

Q: Does Φ(G, C1, ... Cx) hold?

The properties ”G has an independent set of size 10” and ”G has an independent set of size 100” need different formulas!

Page 34: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

COURCELLE’S THEOREM(S)

V1.0: For every CMSOL property Φ and integer t, there is a linear time algorithm for Φ-Model-Checking on graphs of treewidth t.

V1.1: For every CMSOL property Φ and integer t,

there is a linear time algorithm for Φ-Optimization on graphs of treewidth t.

Often accredited to Courcelle, actually provedby Arnborg, Lagergren and Seese.

Page 35: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

OPTIMIZING F(TW)

Until recently, fairly naive algorithms were the best ones known for most problems, and we did not know why. In 2008, the list to beat was:

2twn for ISET 4twn for DOMSET qtwn for q-Coloring tw!n for Hamiltonian Cycle

Page 36: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

OPTIMIZING F(TW) – CURRENT PICTURE

2twn for ISET 3twn for DOMSET [new upper bound, ESA09] qtwn for q-Coloring 4twn for Hamiltonian Cycle

[new upper bound, Arxiv’11]

Matching Lower boundsunder SETH, SODA’11

Page 37: A N INTRODUCTION TO T REEWIDTH Daniel Lokshtanov, UCSD

Thank you!