Computing Treedepth

Felix Reidl, Peter Rossmanith, Fernando S´anchezVillaamil Somnath Sikdar

RWTH Aachen

March 14, 2014

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 1 / 38 Treedepth

Treedepth is a width measure.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 2 / 38 Treedepth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 3 / 38 Treedepth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 3 / 38 Treedepth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 3 / 38 Treedepth

5 3 2 1 7 6

4 8

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 4 / 38 Treedepth

5 3 1 2 1 2 3 4 7 6 6 5 7 8 4 8

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 4 / 38 Treedepth

5 3 1 2 1 2 3 4 7 6 6 5 7 8 4 8

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 4 / 38 Treedepth

4 1 2 3 4 3 5 7 6 5 1 2 7 6

Treedepth t → Maximal path length 2t − 1.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 5 / 38 Treedepth

Treedepth t → Maximal path length 2t − 1.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 6 / 38 Treedepth

Treedepth t → Maximal path length 2t − 1.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 6 / 38 Treedepth

Definition (Treedepth decomposition) A treedepth decomposition of a graph G is a rooted forest F such that V (G) ⊆ V (F ) and E(G) ⊆ E(clos(F )).

Definition (Treedepth) The treedepth td(G) of a graph G is the minimum height of any treedepth decomposition of G.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 7 / 38 Treedepth Equivalent notions

A graph G has treedepth at most t if and only if: G is a subgraph the closure of a (forest) of height t G is the subgraph of a trivially with size at most t G has a centered coloring with t colors G has a ranked coloring with t colors

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 8 / 38 Treedepth t ⇒ Maximal path length 2t − 1 ⇒ 2t -approximation

Treedepth Basic results A DFS is a Treedepth decomposition

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 9 / 38 Treedepth t ⇒ Maximal path length 2t − 1 ⇒ 2t -approximation

Treedepth Basic results A DFS is a Treedepth decomposition

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 9 / 38 Treedepth Basic results A DFS is a Treedepth decomposition

Treedepth t ⇒ Maximal path length 2t − 1 ⇒ 2t -approximation

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 9 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Treedepth Basic results Treedepth to pathwidth

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 Treedepth Basic results Treedepth to pathwidth

tw(G) ≤ pw(G) ≤ td(G) − 1

Treedepth t ⇒ Path decomposition of width 2t − 2

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 10 / 38 Problem Is there a simple linear time algorithm to check td(G) ≤ t for fixed t?

Treedepth Basic results

Known ways to compute the treedepth of a graph: In f (t) · n3 time by Robertson and Seymour.

.t . . tw(G) ≤ td(G) − 1 ⇒ By Courcelle’s Theorem 222 · n.

Algorithm by Bodlaender et. al. with running time 2O(w 2t) · n2.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 11 / 38 Treedepth Basic results

Known ways to compute the treedepth of a graph: In f (t) · n3 time by Robertson and Seymour.

.t . . tw(G) ≤ td(G) − 1 ⇒ By Courcelle’s Theorem 222 · n.

Algorithm by Bodlaender et. al. with running time 2O(w 2t) · n2.

Problem Is there a simple linear time algorithm to check td(G) ≤ t for fixed t?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 11 / 38 Both results follow from an algorithm on tree decompositions which runs in time 2O(wt) · n.

Treedepth Basic results

Our results: A (relatively) simple direct algorithm in time 22O(t) · n. A fast algorithm in time 2O(t2) · n.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 12 / 38 Treedepth Basic results

Our results: A (relatively) simple direct algorithm in time 22O(t) · n. A fast algorithm in time 2O(t2) · n.

Both results follow from an algorithm on tree decompositions which runs in time 2O(wt) · n.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 12 / 38 Algorithm

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 13 / 38 Algorithm

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 13 / 38 Algorithm

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 14 / 38 Algorithm

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 14 / 38 Algorithm

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 14 / 38 Algorithm

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 15 / 38 Any partial decomposition has less than wt nodes.

Counting How many trees with labeled leaves? How many height labelings per tree?

Algorithm

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 16 / 38 Counting How many trees with labeled leaves? How many height labelings per tree?

Algorithm

Any partial decomposition has less than wt nodes.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 16 / 38 Algorithm

Any partial decomposition has less than wt nodes.

Counting How many trees with labeled leaves? How many height labelings per tree?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 16 / 38 Algorithm How many trees with labeled leaves?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 17 / 38 Algorithm How many trees with labeled leaves?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 17 / 38 Algorithm How many trees with labeled leaves?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 17 / 38 Algorithm How many trees with labeled leaves?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 17 / 38 Algorithm How many trees with labeled leaves?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 17 / 38 Algorithm How many trees with labeled leaves?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 17 / 38 w Y it · t ≤ w! · t2w ≤ 22w log t+w log w = 2O(wt) i=1

Algorithm How many trees with labeled leaves?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 18 / 38 ≤ w! · t2w ≤ 22w log t+w log w = 2O(wt)

Algorithm How many trees with labeled leaves?

w Y it · t i=1

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 18 / 38 ≤ 22w log t+w log w = 2O(wt)

Algorithm How many trees with labeled leaves?

w Y it · t ≤ w! · t2w i=1

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 18 / 38 = 2O(wt)

Algorithm How many trees with labeled leaves?

w Y it · t ≤ w! · t2w ≤ 22w log t+w log w i=1

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 18 / 38 Algorithm How many trees with labeled leaves?

w Y it · t ≤ w! · t2w ≤ 22w log t+w log w = 2O(wt) i=1

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 18 / 38 (2t )w = 2O(wt)

Algorithm How many height labelings per tree?

How many labeling can a path have?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 19 / 38 (2t )w = 2O(wt)

Algorithm How many height labelings per tree?

How many labeling can a path have?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 19 / 38 (2t )w = 2O(wt)

Algorithm How many height labelings per tree?

How many labeling can a path have?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 19 / 38 Algorithm How many height labelings per tree?

How many labeling can a path have?

(2t )w = 2O(wt)

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 19 / 38 Algorithm

The total number of labeled trees is 2O(wt) · 2O(wt) = 2O(wt).

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 20 / 38 Algorithm Restricting treedepth decompositions Non-trivially improvable treedepth decompositions

5

3 1 2 1 3 4 7 6 2 7 4 8 8 6 5

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 21 / 38 Algorithm Restricting treedepth decompositions Non-trivially improvable treedepth decompositions

5

3 1 2 1 3 4 7 6 2 7 4 8 8 6 5

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 21 / 38 Algorithm Restricting treedepth decompositions Non-trivially improvable treedepth decompositions

5 3 1 2 1 2 3 4 7 6 6 5 7 8 4 8

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 21 / 38 Definition (Nice treedepth decomposition) Consider a treedepth decomposition T of G that is not trivially improvable. We say that T is nice if for every vertex x ∈ V (T ), the subgraph of G induced by the vertices in Tx is connected.

Algorithm Restricting treedepth decompositions

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 22 / 38 Algorithm Restricting treedepth decompositions

Definition (Nice treedepth decomposition) Consider a treedepth decomposition T of G that is not trivially improvable. We say that T is nice if for every vertex x ∈ V (T ), the subgraph of G induced by the vertices in Tx is connected.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 22 / 38 Algorithm Restricting treedepth decompositions

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 23 / 38 Algorithm Restricting treedepth decompositions

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 23 / 38 Algorithm Restricting treedepth decompositions

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 23 / 38 Algorithm Restricting treedepth decompositions

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 23 / 38 Algorithm Restricting treedepth decompositions

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 23 / 38 Algorithm Restricting treedepth decompositions

Lemma For any graph there exists a treedepth decomposition of minimal depth which is nice and non-trivially improvable.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 24 / 38 Algorithm Leaf

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 25 / 38 Algorithm Dynamic programming Forget

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 26 / 38 Algorithm Dynamic programming Forget

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 26 / 38 Algorithm Dynamic programming Forget

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 26 / 38 Algorithm Dynamic programming Introduce

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 27 / 38 Algorithm Dynamic programming Introduce

1 We guess every tree T with the following conditions:

I X ∪ {u} ⊆ V (T ), I All leafs are in X ∪ {u}, I Height at most t. 2 We keep some, dismiss others.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 28 / 38 Algorithm Dynamic programming Introduce

Throw away if edges of X are missing

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 29 / 38 Algorithm Dynamic programming Topological generalization

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 30 / 38 Algorithm Dynamic programming Topological generalization

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 30 / 38 Algorithm Dynamic programming Topological generalization

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 30 / 38 Algorithm Dynamic programming Topological generalization

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 30 / 38 Algorithm Dynamic programming Topological generalization

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 30 / 38 Algorithm Dynamic programming Topological generalization

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 30 / 38 Algorithm Dynamic programming Topological generalization

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 30 / 38 Algorithm Dynamic programming Introduce

1 Guess tree with certain conditions:

I X ∪ {u} ⊆ V (T ), I All leafs are in X ∪ {u}, I Height at most t. 2 If edge missing between nodes of X ∪ {u}, discard. 3 If not a topological generalization of an element in old table, discard.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 31 / 38 Algorithm Dynamic programming Why should this work?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 32 / 38 Algorithm Dynamic programming Why should this work?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 32 / 38 Algorithm Dynamic programming Why should this work?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 32 / 38 Algorithm Dynamic programming Why should this work?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 32 / 38 Algorithm Dynamic programming Why should this work?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 32 / 38 Algorithm Dynamic programming

Theorem Given a graph G with n nodes and a of G of width w the treedepth t of G can be decided in time 2O(wt) · n.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 33 / 38 Algorithm Simple algorithm Simple algorithm

1 Depth-first-search to construct treedepth decomposition T . 2 If depth greater than 2t − 1 say NO. 3 Construct path decomposition P from T of width 2t . 4 Run algorithm on P.

Theorem There is a (simple) algorithm to decide if a graph G with n nodes has treedepth t which runs in time 22O(t) · n.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 34 / 38 Algorithm Fast algorithm Fast algorithm

1 Use single exponential 5-approximation for treewidth1. 2 Remember tw(G) ≤ pw(G) ≤ td(G) − 1. 3 If width is greater than 5t say NO. 4 Else run algorithm on tree decomposition.

Theorem There is a algorithm to decide if a graph G with n nodes has treedepth t which runs in time 2O(t2) · n.

1Very useful result by Hans Bodlaender, P˚alG. Drange, Markus S. Dregi, Fedor V. Fomin, Daniel Lokshtanov and Michal Pilipczuk Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 35 / 38 Algorithm Conclusion

We have seen: An algorithm on tree decompositions which runs in time 2O(wt) · n. A (relatively) simple direct algorithm in time 22O(t) · n. A fast algorithm in time 2O(t2) · n.

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 36 / 38 Algorithm Conclusion Related Questions

Is it sensible to implement? Can we approximate treedepth in time 2O(t) · n. Can we find new algorithms on treedepth which are better than working in the path decomposition given by a treedepth decomposition?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 37 / 38 Algorithm Conclusion

Thank you for listening. Questions?

Fernando S´anchez Villaamil (RWTH) Computing Treedepth March 14, 2014 38 / 38