Algebraic techniques in parameterized algorithms ukasz Kowalik - - PowerPoint PPT Presentation

algebraic techniques in parameterized algorithms
SMART_READER_LITE
LIVE PREVIEW

Algebraic techniques in parameterized algorithms ukasz Kowalik - - PowerPoint PPT Presentation

Algebraic techniques in parameterized algorithms ukasz Kowalik University of Warsaw FPT School, Bdlewo, August 2014 ukasz Kowalik (UW) Algebraic techniques August 2014 1 / 37 Overview Inclusion-exclusion principle (Tuesday)


slide-1
SLIDE 1

Algebraic techniques in parameterized algorithms

Łukasz Kowalik

University of Warsaw

FPT School, Będlewo, August 2014

Łukasz Kowalik (UW) Algebraic techniques August 2014 1 / 37

slide-2
SLIDE 2

Overview

Inclusion-exclusion principle (Tuesday) Polynomials over finite fields of characteristic two (Thursday) Group algebras (Friday)

Łukasz Kowalik (UW) Algebraic techniques August 2014 2 / 37

slide-3
SLIDE 3

Algebraic techniques in parameterized algorithms, Part I: Inclusion-Exclusion

Łukasz Kowalik

University of Warsaw

FPT School, Będlewo, August 2014

Łukasz Kowalik (UW) Algebraic techniques I August 2014 3 / 37

slide-4
SLIDE 4

Inclusion-Exclusion Principle

Theorem (Inclusion-Exclusion Principle, intersection version)

Let A1, . . . , An ⊆ U, where U is a finite set. Then: |

  • i∈{1,...,n}

Ai| =

  • X⊆{1,...,n}

(−1)|X||

  • i∈X

Ai| where Ai = U − Ai and

i∈∅ Ai = U.

  • Example. |A ∩ B| = |U| − |A| − |B| + |A ∩ B|

A B U 1 1 1 1 A B U 1 −1 A B U 1

|U| |U| − |A| − |B| |U| − |A| − |B| + |A ∩ B|

Łukasz Kowalik (UW) Algebraic techniques I August 2014 4 / 37

slide-5
SLIDE 5

Inclusion-Exclusion Principle, intersection version

Theorem (Inclusion-Exclusion Principle, intersection version)

Let A1, . . . , An ⊆ U, where U is a finite set. ({Ai}n

i=1 =“requirements”.)

Denote Ai = U − Ai and

i∈∅ Ai = U.

Then: |

  • i∈{1,...,n}

Ai| =

  • X⊆{1,...,n}

(−1)|X| |

  • i∈X

Ai|

“simplified problem”

A common algorithmic application

Reduce a hard task to 2n “simplified problems” (solvable in poly-time).

IE

Łukasz Kowalik (UW) Algebraic techniques I August 2014 5 / 37

slide-6
SLIDE 6

The number of Hamiltonian cycles

Hamiltonian cycle: a cycle that contains all the vertices.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 6 / 37

slide-7
SLIDE 7

The number of Hamiltonian cycles

Hamiltonian cycle: a cycle that contains all the vertices.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 6 / 37

slide-8
SLIDE 8

The number of Hamiltonian cycles

A walk of length k in G (shortly, a k-walk) is a sequence of vertices v0, v1, . . . , vk such that vivi+1 ∈ E for each i = 0, . . . , k − 1. v0 v1 v3 v4 v2 = v5 v6 v7

Łukasz Kowalik (UW) Algebraic techniques I August 2014 7 / 37

slide-9
SLIDE 9

The number of Hamiltonian cycles

A walk of length k in G (shortly, a k-walk) is a sequence of vertices v0, v1, . . . , vk such that vivi+1 ∈ E for each i = 0, . . . , k − 1. v0 v1 v3 v4 v2 = v5 v6 v7 A walk is closed, when v0 = vk.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 7 / 37

slide-10
SLIDE 10

The number of Hamiltonian cycles

A walk of length k in G (shortly, a k-walk) is a sequence of vertices v0, v1, . . . , vk such that vivi+1 ∈ E for each i = 0, . . . , k − 1. v0 v1 v3 v4 v2 = v5 v6 v7 A walk is closed, when v0 = vk. U is the set of closed n-walks from vertex 1.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 7 / 37

slide-11
SLIDE 11

The number of Hamiltonian cycles

A walk of length k in G (shortly, a k-walk) is a sequence of vertices v0, v1, . . . , vk such that vivi+1 ∈ E for each i = 0, . . . , k − 1. v0 v1 v3 v4 v2 = v5 v6 v7 A walk is closed, when v0 = vk. U is the set of closed n-walks from vertex 1. Av = the walks from U that visit v, v ∈ V .

Łukasz Kowalik (UW) Algebraic techniques I August 2014 7 / 37

slide-12
SLIDE 12

The number of Hamiltonian cycles

A walk of length k in G (shortly, a k-walk) is a sequence of vertices v0, v1, . . . , vk such that vivi+1 ∈ E for each i = 0, . . . , k − 1. v0 v1 v3 v4 v2 = v5 v6 v7 A walk is closed, when v0 = vk. U is the set of closed n-walks from vertex 1. Av = the walks from U that visit v, v ∈ V . Then the solution is |

v∈V Av|.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 7 / 37

slide-13
SLIDE 13

The number of Hamiltonian cycles

A walk of length k in G (shortly, a k-walk) is a sequence of vertices v0, v1, . . . , vk such that vivi+1 ∈ E for each i = 0, . . . , k − 1. v0 v1 v3 v4 v2 = v5 v6 v7 A walk is closed, when v0 = vk. U is the set of closed n-walks from vertex 1. Av = the walks from U that visit v, v ∈ V . Then the solution is |

v∈V Av|.

The simplified problem: |

v∈X Av| = the number of closed walks

from U in G ′ = G[V − X].

Łukasz Kowalik (UW) Algebraic techniques I August 2014 7 / 37

slide-14
SLIDE 14

The number of Hamiltonian cycles, cont’d

The simplified problem

Compute the number of closed n-walks in G ′ that start at vertex 1.

Dynamic programming

T(d, x) = the number of length d walks from 1 to x. T(d, x) =

yx∈E(G ′) T(d − 1, y).

We return T(n, 1), DP works in O(n3) time.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 8 / 37

slide-15
SLIDE 15

The number of Hamiltonian cycles, cont’d

The simplified problem

Compute the number of closed n-walks in G ′ that start at vertex 1.

Dynamic programming

T(d, x) = the number of length d walks from 1 to x. T(d, x) =

yx∈E(G ′) T(d − 1, y).

We return T(n, 1), DP works in O(n3) time.

Theorem (Kohn, Gottlieb, Kohn 1969, Karp 1982, Bax 1993)

We can solve the Hamiltonian Cycle problem (and even find the number of such cycles) in O(2nn3) = 2nnO(1) time and polynomial space.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 8 / 37

slide-16
SLIDE 16

Coloring

k-coloring

k-coloring of a graph G = (V , E) is a function c : V → {1, . . . , k} such that for every edge xy ∈ E, c(x) = c(y).

Problem

Given a graph G = (V , E) and k ∈ N decide whether there is a k-coloring of G.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 9 / 37

slide-17
SLIDE 17

Coloring

k-coloring

k-coloring of a graph G = (V , E) is a function c : V → {1, . . . , k} such that for every edge xy ∈ E, c(x) = c(y).

Problem

Given a graph G = (V , E) and k ∈ N decide whether there is a k-coloring of G.

History

(naive) knnO(1) Lawler 1976: Dynamic programming O(2.45n) Björklund, Husfeldt, Koivisto 2006: Inclusion-Exclusion 2nnO(1)

Łukasz Kowalik (UW) Algebraic techniques I August 2014 9 / 37

slide-18
SLIDE 18

Coloring via inclusion-exclusion in 2nnO(1) time

Observation

There is a k-coloring of graph G = (V , E)

  • There is a partition of V into k independent sets

Łukasz Kowalik (UW) Algebraic techniques I August 2014 10 / 37

slide-19
SLIDE 19

Coloring via inclusion-exclusion, first attempt

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets (not necessarily disjoint nor even different!)

Łukasz Kowalik (UW) Algebraic techniques I August 2014 11 / 37

slide-20
SLIDE 20

Coloring via inclusion-exclusion, first attempt

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets (not necessarily disjoint nor even different!) U contains all colorings

Łukasz Kowalik (UW) Algebraic techniques I August 2014 11 / 37

slide-21
SLIDE 21

Coloring via inclusion-exclusion, first attempt

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets (not necessarily disjoint nor even different!) U contains all colorings Av = {(I1, . . . , Ik) ∈ U : there is exactly one j such that v ∈ Ij}

Łukasz Kowalik (UW) Algebraic techniques I August 2014 11 / 37

slide-22
SLIDE 22

Coloring via inclusion-exclusion, first attempt

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets (not necessarily disjoint nor even different!) U contains all colorings Av = {(I1, . . . , Ik) ∈ U : there is exactly one j such that v ∈ Ij} Then |

v∈V Av| is the number of k-colorings.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 11 / 37

slide-23
SLIDE 23

Coloring via inclusion-exclusion, first attempt

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets (not necessarily disjoint nor even different!) U contains all colorings Av = {(I1, . . . , Ik) ∈ U : there is exactly one j such that v ∈ Ij} Then |

v∈V Av| is the number of k-colorings.

The simplified problem: |

v∈X Av| = ??

Łukasz Kowalik (UW) Algebraic techniques I August 2014 11 / 37

slide-24
SLIDE 24

Coloring via inclusion-exclusion in 2nnO(1) time

Observation

There is a k-coloring of graph G = (V , E)

  • There is a partition of V into k independent sets
  • there is a cover of V by k independent sets,

(i.e. k independent sets I1, . . . , Ik such that k

j=1 Ij = V .)

Łukasz Kowalik (UW) Algebraic techniques I August 2014 12 / 37

slide-25
SLIDE 25

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-26
SLIDE 26

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets Av = {(I1, . . . , Ik) ∈ U : v ∈ k

j=1 Ij}

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-27
SLIDE 27

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets Av = {(I1, . . . , Ik) ∈ U : v ∈ k

j=1 Ij}

Then |

v∈V Av| = 0 iff G is k-colorable.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-28
SLIDE 28

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets Av = {(I1, . . . , Ik) ∈ U : v ∈ k

j=1 Ij}

Then |

v∈V Av| = 0 iff G is k-colorable.

The simplified problem: |

  • v∈X

Av| =

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-29
SLIDE 29

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets Av = {(I1, . . . , Ik) ∈ U : v ∈ k

j=1 Ij}

Then |

v∈V Av| = 0 iff G is k-colorable.

The simplified problem: |

  • v∈X

Av| = |{(I1, . . . , Ik) ∈ U : I1, . . . , Ik ⊆ V − X}|

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-30
SLIDE 30

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets Av = {(I1, . . . , Ik) ∈ U : v ∈ k

j=1 Ij}

Then |

v∈V Av| = 0 iff G is k-colorable.

The simplified problem: |

  • v∈X

Av| = |{(I1, . . . , Ik) ∈ U : I1, . . . , Ik ⊆ V − X}| = s(V − X)k where s(Y ) = the number of independent sets in G[Y ].

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-31
SLIDE 31

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets Av = {(I1, . . . , Ik) ∈ U : v ∈ k

j=1 Ij}

Then |

v∈V Av| = 0 iff G is k-colorable.

The simplified problem: |

  • v∈X

Av| = |{(I1, . . . , Ik) ∈ U : I1, . . . , Ik ⊆ V − X}| = s(V − X)k where s(Y ) = the number of independent sets in G[Y ]. s(Y ) can be computed at the beginning for all subsets Y ⊆ V : s(Y ) = s(Y − {y}) + s(Y − N[y]). This takes time (and space) 2nnO(1) . (Note: s(Y ) is stored using at most n bits).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-32
SLIDE 32

Coloring in 2n, cont’d

U is the set of tuples (I1, . . . , Ik), where Ij are independent sets Av = {(I1, . . . , Ik) ∈ U : v ∈ k

j=1 Ij}

Then |

v∈V Av| = 0 iff G is k-colorable.

The simplified problem: |

  • v∈X

Av| = |{(I1, . . . , Ik) ∈ U : I1, . . . , Ik ⊆ V − X}| = s(V − X)k where s(Y ) = the number of independent sets in G[Y ]. s(Y ) can be computed at the beginning for all subsets Y ⊆ V : s(Y ) = s(Y − {y}) + s(Y − N[y]). This takes time (and space) 2nnO(1) . (Note: s(Y ) is stored using at most n bits). Next, we compute |

v∈X Av| easily in nO(1) time, so we get

|

v∈V Av| in 2nnO(1) time.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 13 / 37

slide-33
SLIDE 33

Coloring in 2n, cont’d

Theorem

In 2nnO(1) time and space we can find a k-coloring or conclude it does not exist, find the chromatic number.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 14 / 37

slide-34
SLIDE 34

Coloring in 2n, cont’d

Theorem

In 2nnO(1) time and space we can find a k-coloring or conclude it does not exist, find the chromatic number.

Theorem

In O(2.24n) time and polynomial space we can find a k-coloring of a given graph G or conclude that it does not exist.

Proof

We compute s(Y ) in O(1.2377n) time and polynomial space by the algorithm of Wahlström (2008). Total time:

  • X⊆V

1.2377|X| =

n

  • k=0

n k

  • 1.2377k = (1 + 1.2377)n = O(2.24n).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 14 / 37

slide-35
SLIDE 35

Steiner Tree in 2k, Nederlof 2009

Unweighted version

Given graph G = (V , E), the set of terminals K ⊆ V and a number c ∈ N. Is there a tree T ⊆ G such that K ⊆ V (T) and |E(T)| ≤ c?

Łukasz Kowalik (UW) Algebraic techniques I August 2014 15 / 37

slide-36
SLIDE 36

Steiner Tree in 2k, Nederlof 2009

Unweighted version

Given graph G = (V , E), the set of terminals K ⊆ V and a number c ∈ N. Is there a tree T ⊆ G such that K ⊆ V (T) and |E(T)| ≤ c?

Łukasz Kowalik (UW) Algebraic techniques I August 2014 15 / 37

slide-37
SLIDE 37

Steiner Tree in 2k, Nederlof 2009

Unweighted version

Given graph G = (V , E), the set of terminals K ⊆ V and a number c ∈ N. Is there a tree T ⊆ G such that K ⊆ V (T) and |E(T)| ≤ c? Denote n = |V |, k = |K|.

The classical algorithm [Dreyfus, Wagner 1972]

Dynamic programming, works in 3k(nk)O(1) time and 2k(nk)O(1) space, even in the weighted version.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 15 / 37

slide-38
SLIDE 38

Branching walks

Definition

Let G = (V , E) be an undirected graph and let s ∈ V . A branching walk is a pair B = (T, h), where T is an ordered rooted tree and h : V (T) → V is a homomorphism, i.e. if (x, y) ∈ E(T) then h(x)h(y) ∈ E(G). We say that B is from s, when h(r) = s, where r is the root of T. The length of B is defined as |E(T)|.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 16 / 37

slide-39
SLIDE 39

Branching walks

Example 1 Every walk is a branching walk

Łukasz Kowalik (UW) Algebraic techniques I August 2014 17 / 37

slide-40
SLIDE 40

Branching walks

Example 1 Every walk is a branching walk

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

Łukasz Kowalik (UW) Algebraic techniques I August 2014 17 / 37

slide-41
SLIDE 41

Branching walks

Łukasz Kowalik (UW) Algebraic techniques I August 2014 18 / 37

slide-42
SLIDE 42

Branching walks

Example 2 An injective homomorphism.

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

Łukasz Kowalik (UW) Algebraic techniques I August 2014 18 / 37

slide-43
SLIDE 43

Branching walks

Example 3 A non-injective homomorphism.

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

Łukasz Kowalik (UW) Algebraic techniques I August 2014 19 / 37

slide-44
SLIDE 44

Branching walks

Example 4 An even more non-injective homomorphism.

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

Łukasz Kowalik (UW) Algebraic techniques I August 2014 20 / 37

slide-45
SLIDE 45

Steiner Tree, unweighted

For a branching walk B = (TB, h) denote V (B) = h(V (TB)). Let s ∈ K be any terminal.

Observation

G contains a tree T such that K ⊆ V (T) and |E(T)| ≤ c iff G contains a branching walk B = (TB, h) from s in G such that K ⊆ V (B) and |E(TB)| ≤ c.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 21 / 37

slide-46
SLIDE 46

Steiner Tree, unweighted

For a branching walk B = (TB, h) denote V (B) = h(V (TB)). Let s ∈ K be any terminal.

Observation

G contains a tree T such that K ⊆ V (T) and |E(T)| ≤ c iff G contains a branching walk B = (TB, h) from s in G such that K ⊆ V (B) and |E(TB)| ≤ c. U is the set of all length c branching walks from s.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 21 / 37

slide-47
SLIDE 47

Steiner Tree, unweighted

For a branching walk B = (TB, h) denote V (B) = h(V (TB)). Let s ∈ K be any terminal.

Observation

G contains a tree T such that K ⊆ V (T) and |E(T)| ≤ c iff G contains a branching walk B = (TB, h) from s in G such that K ⊆ V (B) and |E(TB)| ≤ c. U is the set of all length c branching walks from s. Av = {B ∈ U : v ∈ V (B)} for v ∈ K.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 21 / 37

slide-48
SLIDE 48

Steiner Tree, unweighted

For a branching walk B = (TB, h) denote V (B) = h(V (TB)). Let s ∈ K be any terminal.

Observation

G contains a tree T such that K ⊆ V (T) and |E(T)| ≤ c iff G contains a branching walk B = (TB, h) from s in G such that K ⊆ V (B) and |E(TB)| ≤ c. U is the set of all length c branching walks from s. Av = {B ∈ U : v ∈ V (B)} for v ∈ K. Then |

v∈K Av| = 0 iff there is the desired Steiner Tree.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 21 / 37

slide-49
SLIDE 49

Steiner Tree, unweighted

For a branching walk B = (TB, h) denote V (B) = h(V (TB)). Let s ∈ K be any terminal.

Observation

G contains a tree T such that K ⊆ V (T) and |E(T)| ≤ c iff G contains a branching walk B = (TB, h) from s in G such that K ⊆ V (B) and |E(TB)| ≤ c. U is the set of all length c branching walks from s. Av = {B ∈ U : v ∈ V (B)} for v ∈ K. Then |

v∈K Av| = 0 iff there is the desired Steiner Tree.

The simplified problem: for every X ⊆ K compute |

  • v∈X

Av| = bV \X

c

(s), where bV \X

j

(a) = the number of length j branching walks from a in G[V \ X].

Łukasz Kowalik (UW) Algebraic techniques I August 2014 21 / 37

slide-50
SLIDE 50

Steiner Tree, the simplified problem

bV \X

j

(a) = the number of length j branching walks from a in G[V \ X].

The simplified problem

For any X ⊆ K compute bV \X

c

(s).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 22 / 37

slide-51
SLIDE 51

Steiner Tree, the simplified problem

bV \X

j

(a) = the number of length j branching walks from a in G[V \ X].

The simplified problem

For any X ⊆ K compute bV \X

c

(s).

Dynamic Programming: computing bV \X

c

(s) in polynomial time

Compute bV \X

j

(a) for all j = 0, . . . , c and a ∈ V \ X using DP: bV \X

j

(a) =      1 if j = 0,

  • t∈N(a)\X
  • j1+j2=j−1

bV \X

j1

(a)bV \X

j2

(t)

  • therwise.

a t j2 j1

Łukasz Kowalik (UW) Algebraic techniques I August 2014 22 / 37

slide-52
SLIDE 52

Steiner Tree, conclusion

Corollary [Nederlof 2009]

The unweighted Steiner Tree problem can be solved in 2k(nk)O(1) time and polynomial space.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 23 / 37

slide-53
SLIDE 53

The zeta ζ transform and the Möbius µ transform

We consider functions from subsets of a finite set V to some ring – for simplicity let us fix the ring (Z, +, ·). f : 2V → Z The transforms below transform f into another function g : 2V → Z.

The Zeta transform

(ζf )(X) =

Y ⊆X f (Y ).

X

The Möbius transform

(µf )(X) =

Y ⊆X(−1)|X\Y |f (Y ).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 24 / 37

slide-54
SLIDE 54

Why ζ and µ are cool?

The Zeta and Möbius transforms

(ζf )(X) =

Y ⊆X f (Y )

(µf )(X) =

Y ⊆X(−1)|X\Y |f (Y ).

Inversion formula

For every X ⊆ V , we have f (X) = (µζf )(X) = (ζµf )(X).

  • Proof. µζf (X)

=

  • Y ⊆X

(−1)|X\Y |(ζf )(Y ) =

  • Y ⊆X

(−1)|X\Y |

Z⊆Y

f (Z) =

  • Z⊆X

f (Z) ·

  • Z⊆Y ⊆X

(−1)|X\Y | = f (X) +

  • ZX

f (Z) ·

  • Z⊆Y ⊆X

(−1)|X\Y | = f (X) +

  • ZX

f (Z) ·

  • X\Y ⊆X\Z

(−1)|X\Y |

  • Łukasz Kowalik (UW)

Algebraic techniques I August 2014 25 / 37

slide-55
SLIDE 55

Hamiltonian cycle revisited

Counting HCs in a directed graph G = (V , E), V = {1, . . . , n}

For X ⊆ V , let f (X) be the number of closed n-walks W from vertex 1 such that V (W ) = X. Then:

Łukasz Kowalik (UW) Algebraic techniques I August 2014 26 / 37

slide-56
SLIDE 56

Hamiltonian cycle revisited

Counting HCs in a directed graph G = (V , E), V = {1, . . . , n}

For X ⊆ V , let f (X) be the number of closed n-walks W from vertex 1 such that V (W ) = X. Then: f (V ) is the number of Hamiltonian cycles in G.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 26 / 37

slide-57
SLIDE 57

Hamiltonian cycle revisited

Counting HCs in a directed graph G = (V , E), V = {1, . . . , n}

For X ⊆ V , let f (X) be the number of closed n-walks W from vertex 1 such that V (W ) = X. Then: f (V ) is the number of Hamiltonian cycles in G. (ζf )(X) =

S⊆X f (X) is the number of closed n-walks W from

vertex 1 such that V (W ) ⊆ X.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 26 / 37

slide-58
SLIDE 58

Hamiltonian cycle revisited

Counting HCs in a directed graph G = (V , E), V = {1, . . . , n}

For X ⊆ V , let f (X) be the number of closed n-walks W from vertex 1 such that V (W ) = X. Then: f (V ) is the number of Hamiltonian cycles in G. (ζf )(X) =

S⊆X f (X) is the number of closed n-walks W from

vertex 1 such that V (W ) ⊆ X. Hence for every X, the value of (ζf )(X) can be computed in O(n3) time (DP).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 26 / 37

slide-59
SLIDE 59

Hamiltonian cycle revisited

Counting HCs in a directed graph G = (V , E), V = {1, . . . , n}

For X ⊆ V , let f (X) be the number of closed n-walks W from vertex 1 such that V (W ) = X. Then: f (V ) is the number of Hamiltonian cycles in G. (ζf )(X) =

S⊆X f (X) is the number of closed n-walks W from

vertex 1 such that V (W ) ⊆ X. Hence for every X, the value of (ζf )(X) can be computed in O(n3) time (DP). So we compute f (V ) = (µζf )(V ) =

X⊆V (−1)|V \X|(ζf )(X) in

2nnO(1) time and polynomial space.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 26 / 37

slide-60
SLIDE 60

Computing ζ and µ for all subsets X ⊆ V

(ζf )(X) =

Y ⊆X f (Y )

(µf )(X) =

Y ⊆X(−1)|X\Y |f (Y ).

Naive algorithm

evaluating at single X: O(2|X|). evaluating at all X ⊆ V : O(

X⊆V 2|X|) = O(3|V |).

Yates’ algorithm (1937), described in Knuth’s TAOCP

Given a function f : 2V → Z, we can compute all the 2n values of ζf in 2nnO(1) time. Similarly µf .

Łukasz Kowalik (UW) Algebraic techniques I August 2014 27 / 37

slide-61
SLIDE 61

Fast Zeta Transform: all values of ζf in O(2n · n) time

Let V = {1, . . . , n}. Represent subsets as characteristic vectors: (ζf )(x1, . . . , xn) =

  • y1,...,yn∈{0,1}

y1≤x1,...,yn≤xn

f (y1, . . . , yn). Consider fixing the last n − j bits: ζj(x1, . . . , xn) =

  • y1,...,yj∈{0,1}

y1≤x1,...,yj≤xj

f (y1, . . . , yj, xj+1, . . . , xn

  • fixed

). Consistently, ζ0(x1, . . . , xn) := f (x1, . . . , xn). Note that ζn(X) = ζf (X). Dynamic programming: ζj(x1, . . . , xn) =      ζj−1(x1, . . . , xn) when xj = 0, ζj−1(x1, . . . , xj−1, 1, xj+1, . . . , xn)+ ζj−1(x1, . . . , xj−1, 0, xj+1, . . . , xn) when xj = 1.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 28 / 37

slide-62
SLIDE 62

k-coloring, revisited

For X ⊆ V , let f (X) be the number of tuples (I1, . . . , Ik), where Ij are independent sets in G and k

j=1 Ij = X.

Then:

Łukasz Kowalik (UW) Algebraic techniques I August 2014 29 / 37

slide-63
SLIDE 63

k-coloring, revisited

For X ⊆ V , let f (X) be the number of tuples (I1, . . . , Ik), where Ij are independent sets in G and k

j=1 Ij = X.

Then: f (X) = 0 iff G[X] is k-colorable.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 29 / 37

slide-64
SLIDE 64

k-coloring, revisited

For X ⊆ V , let f (X) be the number of tuples (I1, . . . , Ik), where Ij are independent sets in G and k

j=1 Ij = X.

Then: f (X) = 0 iff G[X] is k-colorable. ζf (X) =

S⊆X f (X) is the number of tuples (I1, . . . , Ik), where Ij are

independent sets in G and k

j=1 Ij ⊆ X.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 29 / 37

slide-65
SLIDE 65

k-coloring, revisited

For X ⊆ V , let f (X) be the number of tuples (I1, . . . , Ik), where Ij are independent sets in G and k

j=1 Ij = X.

Then: f (X) = 0 iff G[X] is k-colorable. ζf (X) =

S⊆X f (X) is the number of tuples (I1, . . . , Ik), where Ij are

independent sets in G and k

j=1 Ij ⊆ X.

so, ζf (X) = s(X)k.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 29 / 37

slide-66
SLIDE 66

k-coloring, revisited

For X ⊆ V , let f (X) be the number of tuples (I1, . . . , Ik), where Ij are independent sets in G and k

j=1 Ij = X.

Then: f (X) = 0 iff G[X] is k-colorable. ζf (X) =

S⊆X f (X) is the number of tuples (I1, . . . , Ik), where Ij are

independent sets in G and k

j=1 Ij ⊆ X.

so, ζf (X) = s(X)k. As before, all 2n values of ζf can be found in 2nnO(1) time and space.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 29 / 37

slide-67
SLIDE 67

k-coloring, revisited

For X ⊆ V , let f (X) be the number of tuples (I1, . . . , Ik), where Ij are independent sets in G and k

j=1 Ij = X.

Then: f (X) = 0 iff G[X] is k-colorable. ζf (X) =

S⊆X f (X) is the number of tuples (I1, . . . , Ik), where Ij are

independent sets in G and k

j=1 Ij ⊆ X.

so, ζf (X) = s(X)k. As before, all 2n values of ζf can be found in 2nnO(1) time and space. Using the Yates’ algorithm we find f = µζf .

Łukasz Kowalik (UW) Algebraic techniques I August 2014 29 / 37

slide-68
SLIDE 68

k-coloring, revisited

For X ⊆ V , let f (X) be the number of tuples (I1, . . . , Ik), where Ij are independent sets in G and k

j=1 Ij = X.

Then: f (X) = 0 iff G[X] is k-colorable. ζf (X) =

S⊆X f (X) is the number of tuples (I1, . . . , Ik), where Ij are

independent sets in G and k

j=1 Ij ⊆ X.

so, ζf (X) = s(X)k. As before, all 2n values of ζf can be found in 2nnO(1) time and space. Using the Yates’ algorithm we find f = µζf . Thus we found all the induced k-colorable subgraphs of G in 2nnO(1) time and space.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 29 / 37

slide-69
SLIDE 69

The cover product

The cover product

The cover product of two functions f , g : 2V → Z is a function (f ∗c g) : 2V → Z such that for every Y ⊆ V , (f ∗c g)(Y ) =

  • A∪B=Y

f (A)g(B).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 30 / 37

slide-70
SLIDE 70

The cover product

The cover product

The cover product of two functions f , g : 2V → Z is a function (f ∗c g) : 2V → Z such that for every Y ⊆ V , (f ∗c g)(Y ) =

  • A∪B=Y

f (A)g(B).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 30 / 37

slide-71
SLIDE 71

Computing the cover product

As usual: We cannot compute (f ∗c g)? Then we compute ζ(f ∗c g). ζ(f ∗c g)(Y ) =

  • X⊆Y
  • A∪B=X

f (A)g(B) =

  • A∪B⊆Y

f (A)g(B) = =  

A⊆Y

f (A)    

B⊆Y

g(B)   = (ζf (Y ))(ζg(Y )).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 31 / 37

slide-72
SLIDE 72

Computing the cover product

As usual: We cannot compute (f ∗c g)? Then we compute ζ(f ∗c g). ζ(f ∗c g)(Y ) =

  • X⊆Y
  • A∪B=X

f (A)g(B) =

  • A∪B⊆Y

f (A)g(B) = =  

A⊆Y

f (A)    

B⊆Y

g(B)   = (ζf (Y ))(ζg(Y )). Hence (f ∗c g)(Y ) = µ((ζf (Y ))(ζg(Y ))).

Fast cover product: an FFT-style algorithm

1 Compute ζf using Yates’ algorithm in time 2nnO(1), 2 Compute ζg using Yates’ algorithm in time 2nnO(1), 3 Compute h = ζ(f ∗c g) using pointwise multiplication in time 2nnO(1), 4 Compute f ∗c g = µh using Yates’ algorithm in time 2nnO(1). Łukasz Kowalik (UW) Algebraic techniques I August 2014 31 / 37

slide-73
SLIDE 73

Cover product: an application in graph coloring

Define s : 2V → {0, 1} where s(X) =

  • 1

if X is independent

  • therwise.

.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 32 / 37

slide-74
SLIDE 74

Cover product: an application in graph coloring

Define s : 2V → {0, 1} where s(X) =

  • 1

if X is independent

  • therwise.

. Then (s ∗c s)(Y ) =

  • A∪B=Y

s(A)s(B) =

  • A∪B=Y

A,B independent

1. (s ∗c s ∗c · · · s

  • k times

)(Y ) =

  • I1∪···∪Ik=Y

I1,. . . ,Ik independent

1.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 32 / 37

slide-75
SLIDE 75

Cover product: an application in graph coloring

Define s : 2V → {0, 1} where s(X) =

  • 1

if X is independent

  • therwise.

. Then (s ∗c s)(Y ) =

  • A∪B=Y

s(A)s(B) =

  • A∪B=Y

A,B independent

1. (s ∗c s ∗c · · · s

  • k times

)(Y ) =

  • I1∪···∪Ik=Y

I1,. . . ,Ik independent

1. s ∗c s ∗c · · · s

  • k times

(Y ) = 0 iff G[Y ] is k-colorable.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 32 / 37

slide-76
SLIDE 76

Cover product: an application in graph coloring

Define s : 2V → {0, 1} where s(X) =

  • 1

if X is independent

  • therwise.

. Then (s ∗c s)(Y ) =

  • A∪B=Y

s(A)s(B) =

  • A∪B=Y

A,B independent

1. (s ∗c s ∗c · · · s

  • k times

)(Y ) =

  • I1∪···∪Ik=Y

I1,. . . ,Ik independent

1. s ∗c s ∗c · · · s

  • k times

(Y ) = 0 iff G[Y ] is k-colorable. By performing cover product k − 1 times (even O(log k) times suffices) we

  • btain yet another algorithm which finds all k-colorable induced subgraphs

in 2nnO(1) time.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 32 / 37

slide-77
SLIDE 77

Subset convolution

Subset convolution

The subset convolution of two functions f , g : 2V → Z is a function (f ∗ g) : 2V → Z such that for every Y ⊆ V , (f ∗ g)(Y ) =

  • X⊆Y

f (X)g(Y − X).

Equivalently...

(f ∗ g)(Y ) =

  • A∪B=Y

A∩B=∅

f (A)g(B).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 33 / 37

slide-78
SLIDE 78

Computing the subset convolution

For f : 2V → Z let fk denote f trimmed to the cardinality k subsets, i.e.: fk(S) =

  • f (S)

if |S| = k,

  • therwise.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 34 / 37

slide-79
SLIDE 79

Computing the subset convolution

For f : 2V → Z let fk denote f trimmed to the cardinality k subsets, i.e.: fk(S) =

  • f (S)

if |S| = k,

  • therwise.

Then (f ∗ g)(Y ) =

  • A∪B=Y

A∩B=∅

f (A)g(B) = =

|Y |

  • i=0
  • A∪B=Y

A∩B=∅ |A|=i

f (A)g(B) =

|Y |

  • i=0
  • A∪B=Y

|A|=i |B|=|Y |−i

f (A)g(B) = =

|Y |

  • i=0
  • A∪B=Y

fi(A)g|Y |−i(B) =

|Y |

  • i=0

(fi ∗c g|Y |−i)(Y ).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 34 / 37

slide-80
SLIDE 80

Computing the subset convolution

We got: (∗) (f ∗ g)(Y ) =

|Y |

  • i=0

(fi ∗c g|Y |−i)(Y ). Algorithm:

1 Compute and store fi ∗c gj(Y ) for all i, j = 0, . . . , n and Y ⊆ 2V . 2 Compute (f ∗ g)(Y ) for all Y ⊆ 2V using (∗).

Corollary

One can compute f ∗ g in 2nnO(1) time.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 35 / 37

slide-81
SLIDE 81

Applications of fast subset convolution

Recall: (f ∗ g)(Y ) =

  • A∪B=Y

A∩B=∅

f (A)g(B).

An application in graph coloring

s ∗ s ∗ · · · s

  • k times

(V ) is the number of k-colorings of G. Corollary: There is an algorithm which, for every induced subgraph H of G, finds the number of k-colorings of H in total 2nnO(1) time and space.

Speeding-up dynamic programming over tree decomposition

We can speed-up processing the join nodes (see the book and Marcin’s talk

  • n Thursday):

2twtwO(1)n-time algorithm for counting perfect matchings, 3twtwO(1)n-time algorithm for dominating set.

Łukasz Kowalik (UW) Algebraic techniques I August 2014 36 / 37

slide-82
SLIDE 82

Exercises

(Ex 10.6, ?) Extend the 2nnO(1) algorithm for Hamiltonian cycle to weighted version (aka TSP), i.e., find a minimum weight Hamiltonian cycle in a graph G = (V , E) with weight function w : E → {0, . . . , W } in time 2nWnO(1). (Ex 10.7, ) Extend the 2nnO(1) algorithm for coloring to list coloring. (Ex 10.8) Show an algorithm which computes the number of perfect matchings in a given n-vertex bipartite graph in 2n/2nO(1) time. (The solution is called Ryser’s Formula.) (Ex 10.12, ) Show a 2nnO(1) algorithm for computing packing product defined as (f ∗p g)(Y ) =

  • A,B⊆Y

A∩B=∅

f (A)g(B).

Łukasz Kowalik (UW) Algebraic techniques I August 2014 37 / 37