Color Coding

46
Color Coding and Chromatic Coding Venkatesh Raman The Institute of Mathematical Sciences 3 March 2014 Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 1 / 17

Transcript of Color Coding

Page 1: Color Coding

Color Coding and Chromatic Coding

Venkatesh Raman

The Institute of Mathematical Sciences

3 March 2014

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 1 / 17

Page 2: Color Coding

Randomized Algorithms

Let Π ⊆ Σ∗ be a problem.

Algorithm

x ∈ Σ∗

x ∈ Π?(Output correct answer with good probability)

Here we are interested in randomized algorithms for parameterizedproblems taking running time f (k)|x |O(1) with constant successprobability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 2 / 17

Page 3: Color Coding

Randomized Algorithms

Let Π ⊆ Σ∗ be a problem.

Algorithm

x ∈ Σ∗

x ∈ Π?(Output correct answer with good probability)

Here we are interested in randomized algorithms for parameterizedproblems taking running time f (k)|x |O(1) with constant successprobability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 2 / 17

Page 4: Color Coding

Randomized Algorithms

Let Π ⊆ Σ∗ be a problem.

Algorithm

x ∈ Σ∗

x ∈ Π?(Output correct answer with good probability)

Here we are interested in randomized algorithms for parameterizedproblems taking running time f (k)|x |O(1) with constant successprobability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 2 / 17

Page 5: Color Coding

Randomized Algorithms

Let Π ⊆ Σ∗ be a problem.

Algorithm

x ∈ Σ∗

x ∈ Π?(Output correct answer with good probability)

Here we are interested in randomized algorithms for parameterizedproblems taking running time f (k)|x |O(1) with constant successprobability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 2 / 17

Page 6: Color Coding

Randomized Algorithms

Let Π ⊆ Σ∗ be a problem.

Algorithm

x ∈ Σ∗

x ∈ Π?(Output correct answer with good probability)

Here we are interested in randomized algorithms for parameterizedproblems taking running time f (k)|x |O(1) with constant successprobability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 2 / 17

Page 7: Color Coding

Randomized Algorithms

Let Π ⊆ Σ∗ be a problem.

Algorithm

x ∈ Σ∗

x ∈ Π?(Output correct answer with good probability)

Here we are interested in randomized algorithms for parameterizedproblems taking running time f (k)|x |O(1) with constant successprobability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 2 / 17

Page 8: Color Coding

Randomized Algorithm for UFVS

Definition (Feedback Vertex Set)

Let G = (V ,E ) be an undirected graph. S ⊆ V is called feedback vertexset if G \ S is a forest.

Undirected Feedback Vertex Set (UFVS)

Input: An undirected graph G = (V ,E ) and a positive integer kParameter: kQuestion: Does there exists a feedback vertex set of size at most k

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 3 / 17

Page 9: Color Coding

Randomized Algorithm for UFVS

Definition (Feedback Vertex Set)

Let G = (V ,E ) be an undirected graph. S ⊆ V is called feedback vertexset if G \ S is a forest.

Undirected Feedback Vertex Set (UFVS)

Input: An undirected graph G = (V ,E ) and a positive integer kParameter: kQuestion: Does there exists a feedback vertex set of size at most k

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 3 / 17

Page 10: Color Coding

Randomized Algorithm for UFVS

Do the following preprocessing rules

Delete degree ≤ 1 vertices.

Short circuit degree 2 vertices.

Add vertex x to FVS, if x has self loop.

Now we can assume every vertex in G has degree ≥ 3.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 4 / 17

Page 11: Color Coding

Randomized Algorithm for UFVS

Do the following preprocessing rules

Delete degree ≤ 1 vertices.

Short circuit degree 2 vertices.

Add vertex x to FVS, if x has self loop.

Now we can assume every vertex in G has degree ≥ 3.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 4 / 17

Page 12: Color Coding

Randomized Algorithm for UFVS

Do the following preprocessing rules

Delete degree ≤ 1 vertices.

Short circuit degree 2 vertices.

Add vertex x to FVS, if x has self loop.

Now we can assume every vertex in G has degree ≥ 3.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 4 / 17

Page 13: Color Coding

Randomized Algorithm for UFVS

Do the following preprocessing rules

Delete degree ≤ 1 vertices.

Short circuit degree 2 vertices.

Add vertex x to FVS, if x has self loop.

Now we can assume every vertex in G has degree ≥ 3.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 4 / 17

Page 14: Color Coding

Randomized Algorithm for UFVS

Do the following preprocessing rules

Delete degree ≤ 1 vertices.

Short circuit degree 2 vertices.

Add vertex x to FVS, if x has self loop.

Now we can assume every vertex in G has degree ≥ 3.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 4 / 17

Page 15: Color Coding

Randomized Algorithm for UFVS

Do the following preprocessing rules

Delete degree ≤ 1 vertices.

Short circuit degree 2 vertices.

Add vertex x to FVS, if x has self loop.

Now we can assume every vertex in G has degree ≥ 3.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 4 / 17

Page 16: Color Coding

Randomized Algorithm for UFVS

Do the following preprocessing rules

Delete degree ≤ 1 vertices.

Short circuit degree 2 vertices.

Add vertex x to FVS, if x has self loop.

Now we can assume every vertex in G has degree ≥ 3.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 4 / 17

Page 17: Color Coding

Randomized Algorithm for UFVS

Claim : If G is graph with minimum degree ≥ 3, then number of edgesincident to any FVS F is ≥ E(G)

2 .

Proof: Let

V≤1 = set of degree ≤ 1 vertices in H,

V2 = set of degree 2 vertices in H, and

V≥3 = set of degree ≥ 3 vertices in H.

Number of edges between H and F ,

E (H,F ) ≥ 2V≤1 + V2

> V≤1 + V2 + V≥3 (∵ V≤1 > V≥3)

= V (H)> E (H).

F

H=G - F ;

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 5 / 17

Page 18: Color Coding

Randomized Algorithm for UFVS

Claim : If G is graph with minimum degree ≥ 3, then number of edgesincident to any FVS F is ≥ E(G)

2 .

Proof:

Let

V≤1 = set of degree ≤ 1 vertices in H,

V2 = set of degree 2 vertices in H, and

V≥3 = set of degree ≥ 3 vertices in H.

Number of edges between H and F ,

E (H,F ) ≥ 2V≤1 + V2

> V≤1 + V2 + V≥3 (∵ V≤1 > V≥3)

= V (H)> E (H).

F

H=G - F ;

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 5 / 17

Page 19: Color Coding

Randomized Algorithm for UFVS

Claim : If G is graph with minimum degree ≥ 3, then number of edgesincident to any FVS F is ≥ E(G)

2 .

Proof: Let

V≤1 = set of degree ≤ 1 vertices in H,

V2 = set of degree 2 vertices in H, and

V≥3 = set of degree ≥ 3 vertices in H.

Number of edges between H and F ,

E (H,F ) ≥ 2V≤1 + V2

> V≤1 + V2 + V≥3 (∵ V≤1 > V≥3)

= V (H)> E (H).

F

H=G - F ;

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 5 / 17

Page 20: Color Coding

Randomized Algorithm for UFVS

Claim : If G is graph with minimum degree ≥ 3, then number of edgesincident to any FVS F is ≥ E(G)

2 .

Proof: Let

V≤1 = set of degree ≤ 1 vertices in H,

V2 = set of degree 2 vertices in H, and

V≥3 = set of degree ≥ 3 vertices in H.

Number of edges between H and F ,

E (H,F ) ≥ 2V≤1 + V2

> V≤1 + V2 + V≥3 (∵ V≤1 > V≥3)

= V (H)> E (H).

F

H=G - F ;

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 5 / 17

Page 21: Color Coding

Randomized Algorithm for UFVS

Claim : If G is graph with minimum degree ≥ 3, then number of edgesincident to any FVS F is ≥ E(G)

2 .

Proof: Let

V≤1 = set of degree ≤ 1 vertices in H,

V2 = set of degree 2 vertices in H, and

V≥3 = set of degree ≥ 3 vertices in H.

Number of edges between H and F ,

E (H,F ) ≥ 2V≤1 + V2

> V≤1 + V2 + V≥3 (∵ V≤1 > V≥3)

= V (H)> E (H).

F

H=G - F ;

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 5 / 17

Page 22: Color Coding

Randomized Algorithm for UFVS

Claim : If G is graph with minimum degree ≥ 3, then number of edgesincident to any FVS F is ≥ E(G)

2 .

Proof: Let

V≤1 = set of degree ≤ 1 vertices in H,

V2 = set of degree 2 vertices in H, and

V≥3 = set of degree ≥ 3 vertices in H.

Number of edges between H and F ,

E (H,F ) ≥ 2V≤1 + V2

> V≤1 + V2 + V≥3 (∵ V≤1 > V≥3)

= V (H)> E (H).

F

H=G - F ;

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 5 / 17

Page 23: Color Coding

Randomized Algorithm for UFVS

AlgorithmInitially we set S ← ∅. Now run the following steps k times.

1: Apply preprocessing rules and create an equivalent instance (G ′, k ′)

2: Pick an edge e, u.a.r (i.e with probability 1E(G ′))

3: Choose an end point of e, u.a.r (i.e with probability 12) into S and

delete it from the graph.

Now if S is a FVS, output S , otherwise output No.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 6 / 17

Page 24: Color Coding

Analysis

If the input instance is No instance Pr[Algorithm output No] = 1.Let the input instance is Yes instance and F is a FVS od size ≤ k .

Pr[Choosing an edge incident to F in step 2] ≥ 1

2

Pr[Chosen vertex is in F in step 3] ≥ 1

2· 1

2

Pr[S=F] ≥ 1

4k

Now we repeat the algorithm 4k times.

Pr[Algorithm fails in all repetitions] ≤(1− 1

4k

)4k ≤ 1e .

Pr[Algorithm succeed at least once] ≥ 1− 1e ≥

12

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 7 / 17

Page 25: Color Coding

Color Coding

This technique is introduced by Alon et al. (1995)

This technique is used to solve constant treewidth k-sized subgraphisomorphism problem.

We illustrate this technique by applying to k-path

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 8 / 17

Page 26: Color Coding

Color Coding

This technique is introduced by Alon et al. (1995)

This technique is used to solve constant treewidth k-sized subgraphisomorphism problem.

We illustrate this technique by applying to k-path

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 8 / 17

Page 27: Color Coding

k-path

k-path

Input: An undirected graph G and a positive integer kParameter: kQuestion: Does there exists a path on k vertices in G

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 9 / 17

Page 28: Color Coding

Colorful path

v6

v7

v5

v1

v4

v2

v3v6

v7

v5

v1

v4

v2

v3

colorful path on 5 vertices in the graph G ?

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 10 / 17

Page 29: Color Coding

Colorful path

v6

v7

v5

v1

v4

v2

v3v6

v7

v5

v1

v4

v2

v3

colorful path on 5 vertices in the graph G ?

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 10 / 17

Page 30: Color Coding

Algorithm for k-path

Color each vertex of the input graph G , u.a.r using from the set of kcolors, [k]

Check whether there exists a colorful k-path in the colored graph andoutput Yes/No accordingly

Running Time : Time to check colorful k-path × nO(1)

Probability of success

If (G , k) is a No instance, the probability of success is 1.

If (G , k) is an Yes instance, the probability of success is at least k!kk .

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 11 / 17

Page 31: Color Coding

Algorithm for k-path

Color each vertex of the input graph G , u.a.r using from the set of kcolors, [k]

Check whether there exists a colorful k-path in the colored graph andoutput Yes/No accordingly

Running Time : Time to check colorful k-path × nO(1)

Probability of success

If (G , k) is a No instance, the probability of success is 1.

If (G , k) is an Yes instance, the probability of success is at least k!kk .

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 11 / 17

Page 32: Color Coding

Algorithm for k-path

Color each vertex of the input graph G , u.a.r using from the set of kcolors, [k]

Check whether there exists a colorful k-path in the colored graph andoutput Yes/No accordingly

Running Time : Time to check colorful k-path × nO(1)

Probability of success

If (G , k) is a No instance, the probability of success is 1.

If (G , k) is an Yes instance, the probability of success is at least k!kk .

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 11 / 17

Page 33: Color Coding

Algorithm for k-path

Color each vertex of the input graph G , u.a.r using from the set of kcolors, [k]

Check whether there exists a colorful k-path in the colored graph andoutput Yes/No accordingly

Running Time : Time to check colorful k-path × nO(1)

Probability of success

If (G , k) is a No instance, the probability of success is 1.

If (G , k) is an Yes instance, the probability of success is at least k!kk .

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 11 / 17

Page 34: Color Coding

DP for Checking colorful k-path

We introduce 2k · |V (G )| Boolean variables:

x(v ,C ) = TRUE for some v ∈ V (G ) and C ⊆ [k]m

There is path ends at v where each color in C appearsexactly once and no other color appears.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 12 / 17

Page 35: Color Coding

DP for Checking colorful k-path

Clearly, x(v , {color(v)}) = TRUE. Recurrence for vertex v with color r :

x(v ,C ) =∨

uv∈E(G)

x(u,C \ {r})

If we know every x(v ,C ) with |C | = i , then we can determine everyx(v ,C ) with |C | = i + 1. All the values can be determined in timeO(2k · |E (G )|).

There is a colorful path ends at t ⇐⇒ x(t, [k]) = TRUE for some t.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 13 / 17

Page 36: Color Coding

Analysis for k-path

The algorithm for k-path has

Running time 2knO(1)

Success probability

at least k!kk if (G , k) is an Yes instance

1 if (G , k) is an No instance

Now run the algorithm kk

k! (≤ ek) times and output Yes if at least once weget an Yes answer, otherwise output No.

Probability of failure ≤(1− k!

kk

)kk/k! ≤ e−1

k-path can be solved in randomized (2e)knO(1) time, with constant suc-cess probability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 14 / 17

Page 37: Color Coding

Analysis for k-path

The algorithm for k-path has

Running time 2knO(1)

Success probability

at least k!kk if (G , k) is an Yes instance

1 if (G , k) is an No instance

Now run the algorithm kk

k! (≤ ek) times and output Yes if at least once weget an Yes answer, otherwise output No.

Probability of failure ≤(1− k!

kk

)kk/k! ≤ e−1

k-path can be solved in randomized (2e)knO(1) time, with constant suc-cess probability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 14 / 17

Page 38: Color Coding

Analysis for k-path

The algorithm for k-path has

Running time 2knO(1)

Success probability

at least k!kk if (G , k) is an Yes instance

1 if (G , k) is an No instance

Now run the algorithm kk

k! (≤ ek) times and output Yes if at least once weget an Yes answer, otherwise output No.

Probability of failure ≤(1− k!

kk

)kk/k! ≤ e−1

k-path can be solved in randomized (2e)knO(1) time, with constant suc-cess probability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 14 / 17

Page 39: Color Coding

Analysis for k-path

The algorithm for k-path has

Running time 2knO(1)

Success probability

at least k!kk if (G , k) is an Yes instance

1 if (G , k) is an No instance

Now run the algorithm kk

k! (≤ ek) times and output Yes if at least once weget an Yes answer, otherwise output No.

Probability of failure ≤(1− k!

kk

)kk/k! ≤ e−1

k-path can be solved in randomized (2e)knO(1) time, with constant suc-cess probability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 14 / 17

Page 40: Color Coding

Analysis for k-path

The algorithm for k-path has

Running time 2knO(1)

Success probability

at least k!kk if (G , k) is an Yes instance

1 if (G , k) is an No instance

Now run the algorithm kk

k! (≤ ek) times and output Yes if at least once weget an Yes answer, otherwise output No.

Probability of failure ≤(1− k!

kk

)kk/k! ≤ e−1

k-path can be solved in randomized (2e)knO(1) time, with constant suc-cess probability.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 14 / 17

Page 41: Color Coding

Derandomization

Suppose we have a list of colorings col1, col2, . . . , colm such that forany S ⊆ V with |S | = k there exists i , coli is one-to-one on S , theninstead of random coloring we can use these list of colorings to get adeterministic algorithm.

Such a list of colorings is called an (n, k)-family of perfect hashfunctions

There exists an (n, k)-family of perfect hash functions of sizeekkO(log k) log2 n and can be constructed in time linear in the outputsize

k-path can be solved deterministically in (2e)kkO(log k)nO(1) time.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 15 / 17

Page 42: Color Coding

Derandomization

Suppose we have a list of colorings col1, col2, . . . , colm such that forany S ⊆ V with |S | = k there exists i , coli is one-to-one on S , theninstead of random coloring we can use these list of colorings to get adeterministic algorithm.

Such a list of colorings is called an (n, k)-family of perfect hashfunctions

There exists an (n, k)-family of perfect hash functions of sizeekkO(log k) log2 n and can be constructed in time linear in the outputsize

k-path can be solved deterministically in (2e)kkO(log k)nO(1) time.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 15 / 17

Page 43: Color Coding

Derandomization

Suppose we have a list of colorings col1, col2, . . . , colm such that forany S ⊆ V with |S | = k there exists i , coli is one-to-one on S , theninstead of random coloring we can use these list of colorings to get adeterministic algorithm.

Such a list of colorings is called an (n, k)-family of perfect hashfunctions

There exists an (n, k)-family of perfect hash functions of sizeekkO(log k) log2 n and can be constructed in time linear in the outputsize

k-path can be solved deterministically in (2e)kkO(log k)nO(1) time.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 15 / 17

Page 44: Color Coding

Derandomization

Suppose we have a list of colorings col1, col2, . . . , colm such that forany S ⊆ V with |S | = k there exists i , coli is one-to-one on S , theninstead of random coloring we can use these list of colorings to get adeterministic algorithm.

Such a list of colorings is called an (n, k)-family of perfect hashfunctions

There exists an (n, k)-family of perfect hash functions of sizeekkO(log k) log2 n and can be constructed in time linear in the outputsize

k-path can be solved deterministically in (2e)kkO(log k)nO(1) time.

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 15 / 17

Page 45: Color Coding

Chromatic Coding

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 16 / 17

Page 46: Color Coding

Thank You

Venkatesh Raman (IMSc) Randomized Techniques in FPT 3 March 2014 17 / 17