Presentation is loading. Please wait.

Presentation is loading. Please wait.

Randomized Parameterized Algorithms (and de-randomizations)

Similar presentations


Presentation on theme: "Randomized Parameterized Algorithms (and de-randomizations)"— Presentation transcript:

1 Randomized Parameterized Algorithms (and de-randomizations)

2 Color Coding Design randomized algorithm first, then try to de-randomize it.

3 Will give an algorithm for k-path with running time (2e)k+o(k)nO(1).
Input: G, k Question: Is there a path on k vertices in G? Parameter: k Will give an algorithm for k-path with running time (2e)k+o(k)nO(1).

4 Stirling approximation
Randomized Algorithm Consider a random function f : V(G)  {1...k} For a set S on k vertices, what is the probability that all vertices get a different color? Good colorings of S. k! k k ≥ 1 𝑒 𝑘 Possible colorings of S. Stirling approximation

5 Randomized Algorithm Repeat ek⋅t times: Pick random f : V(G)  {1...k} Look for a colorful k-path. For x ≥ 2: 1 4 ≤ 1− 1 𝑥 𝑥 ≤ 1 𝑒 If the algorithm finds a k-path, then G definitely has one. If there is a k-path, the algorithm will find it with probability at least 1− 1− 1 𝑒 𝑘 𝑒 𝑘 ⋅𝑡 ≥1 − 1 𝑒 𝑡

6 Finding a Colorful k-Path
«Exercise» Give a kO(k) time algorithm to determine whether a k-colored graph has a colorful k-path.

7 Finding a Colorful k-Path
Dynamic programming on the colors used by partial solutions. vertex true If exists path on |S| vertices ending in v, using all colors from S. T[S,v] = false otherwise subset of {1...k}

8 Dynamic Programming T[S,v] = u∈N(v) T[S\f v , u] Total time: 2kn2
Is there a path ending in u that uses all colors in S, except v’s color? For each neighbor u of v O(n) time to fill each entry. 2kn table entries Total time: 2kn2

9 Randomized Algorithm Repeat ek⋅100 times: Pick random f : V(G)  {1...k} Look for a colorful k-path. Takes 2kn2 time If the algorithm finds a k-path, then G definitely has one. If there is a k-path, the algorithm will find it with probability at least 1 − 1 𝑒 100 Total time: O((2e)kn2).

10 De-randomization How can we make the algorithm deterministic? Let F = f1...ft be a family of functions with fi: V(G)  {1...k}. F is a k-universal hash family F if for every set S ⊆V(G) of size k, there is an fi ∈ F such that fi makes S colorful.

11 Deterministic Algorithm
Construct a k-universal hash family F. For each f ∈ F: Look for a colorful k-path. Takes t time Takes 2kn2 time If the algorithm finds a k-path, then G definitely has one. If there is a k-path, the algorithm will find it. Total time: O(t + |F|⋅2kn2).

12 Constructing Hash Functions
[NSS’95] Can construct a k-perfect hash family F of size ek+o(k)log n in time ek+o(k)n log n. k-Path in time (2e)k+o(k)nO(1)≤ 5.44knO(1)

13 Random Separation: Set Splitting
Input: Family S1...Sm of sets over a universe U = v1...vn, integer k. Question: Is there a coloring c : U  {0,1} such that at least k sets contain an element colored 0 and an element colored 1? Parameter: k Will give a 2knO(1) time randomized, and a 4knO(1) time deterministic algorithm.

14 The 2knO(1) time randomized algorithm follows directly from the claim.
Pick a random coloring c : V(G)  {1,2}. If c splits at least k sets, return c. If the algorithm returns a coloring, then it is correct. Claim: If there is a coloring ψ that splits at least k sets, then a random coloring will split at least k sets with probability at least 𝑘 The 2knO(1) time randomized algorithm follows directly from the claim.

15 Proof of claim Suppose ψ splits the sets S1...Sk.
Make a bipartite graph G=(A ∪ B, E) as follows: A is a minimal hitting set for S1...Sk colored 0 B is a minimal hitting set for S1...Sk colored 1 For i from 1 to k Add one edge between a vertex in Si ∩ A and a vertex in Si ∩ B.

16 Set Splitting Graph A B

17 Proof of claim, continued.
If c properly colors G then all sets S1...Sk are split. G has ≤ k edges and at most ≤ 2k vertices G has k+x vertices  G has ≥ x components Probability that c properly colors G is at least: Number of proper colorings 2 x 2 k+x = k Number of colorings

18 Set Splitting Randomized Algorithm
Repeat 100 ⋅ 2k times: Pick a random coloring c : V(G)  {1...k}. If c splits at least k sets, return c. Running time: O(2knm) If the algorithm returns a coloring, then it is correct. If there is a coloring that splits k sets, the algorithm will find one with probability 1-1/2100.

19 Universal Coloring Family
Let F = {c1...ct} be a family of colorings V(G)  {0,1} F is a k-universal coloring family if for every set S on at most k vertices and every way of coloring S there is some ci ∈ F which colors S exactly like that.

20 Set Splitting Algorithm
Construct 2k-universal coloring family F For each c ∈ F: If c splits at least k sets, return c. Takes t time If the algorithm returns a coloring, then it is correct. If there is a coloring that splits k sets, the algorithm will find one, since the graph G has ≤ 2k vertices. Running time: O(t + |F|nm)

21 Construction of Universal Coloring Families
[NSS’95] Can construct a k-universal coloring family F of size 2k+o(k)log n in time 2k+o(k)n log n. (We need a 2k-universal coloring family) Set Splitting in time 4k+o(k)nO(1).

22 Induced Subgraph Isomorphism
Input: Graphs G and H, G has maximum degree Δ, |V(H)| = k Question: Does G contain H as an induced subgraph? Parameters: Δ + |V(H)| Naive algorithm: nO(k) Encodes the k-Clique problem (so FPT just by k is unlikely) |V(G)| Will see a ΔO(k) time algorithm

23 Random Separation Delete all blue vertices
Will assume H is connected Color vertices of G red with probability p, blue with probability 1-p Delete all blue vertices Determine whether any (red) connected component is equal to H using Graph Isomorphism in time 2polylog(k)

24 Success Probability If G does not contain H then algorithm always says no If G contains H then: All the vertices of H are colored red with probability pk All the neighbors of H (in G) are colored blue with probability at least (1−p) Δk = 1 Δ k (1− 1 Δ ) Δk ≥ 1 (4Δ) k Success probability: 𝑝 𝑘 (1−p) Δk Set p = 1/Δ

25 Running time Each run of the algorithm takes 2o(k) time. Repeat (4Δ) k times for constant success probability. Total runtime: (4Δ) k+o(k)

26 Derandomization Universal Coloring Families  deterministic algorithm for Induced Subgraph Isomorphism with running time 2 O(Δk) . This can be improved to Δ O(k) .

27 Other variants Simple extension 1: Algorithm for the case where H is not necessarily connected with essentially the same running time. Simple extension 2: Algorithm for Subgraph Isomorphism problem (not induced) with similar ish running time.

28 Feedback Vertex Set Feedback Vertex Set (FVS) IN: G, k Q: Is there a set S of ≤ k vertices such that G\S is a forest?

29 FVS reduction rules R1: Delete vertices of degee ≤ 1 R2: Replace degree 2 vertices by edges (keep multiedges)

30 Σv∈Sd(v) ≥ ⍺ ∙ Σv∈V(G)d(v) (= ⍺ ∙ 2m)
⍺-cover Lemma A set S ⊆ V(G) is an ⍺-cover if Lemma: If R1 and R2 do not apply, then every feedback vertex set S of G is a ¼-cover. Σv∈Sd(v) ≥ ⍺ ∙ Σv∈V(G)d(v) (= ⍺ ∙ 2m)

31 ⍺-cover Lemma Σv∈Sd(v) Σv∈V(G)d(v) -2 S +2
Lemma: If S is a feedback vertex set of G and R1 and R2 do not apply outside S, then S of G is a ¼-cover. Proof: If R1 and R2 do not apply then every feedback vertex is a ¼-cover. Σv∈Sd(v) Σv∈V(G)d(v) -2 S +2

32 Algorithm for FVS while G is not empty Apply R1 and R2 on G exhaustively Select a vertex v with prob = d(v) / 2m. S := S ∪ {v} G := G\v If |S| > k output NO output S Succeeds with probability ¼

33 Feedback Vertex Set Runs in O(k(n+m)) time, succeeds with 1 4 𝑘 probability. So O(4kk(n+m)) time for constant success probability. Expected output solution size is ≤ 4OPT, this is a 4-approximation!

34 Chromatic Coding: 5-Clustering
Input: G, k Question: Can we add/remove ≤ k edges to make G a disjoint union of ≤ 5 cliques? Easy: 3kpoly(n) [Branch on induced P3’s, then greedily join cliques] Next: 2 𝑂( 𝑘 )

35 Coloring Lemma Lemma: Let G be a graph on at most k edges. Then G can be properly colored with at most 2𝑘 + 1 colors. Proof: G is 2𝑘 -degenerate. Use greedy coloring using the degeneracy sequence (reversed) Oblivious to G! Set q = 2 2𝑘 Color G at random with q colors. What is the probability that G is properly colored?

36 Random Coloring Lemma Lemma: Let G be a graph on at most k edges, and q = 2 2𝑘 . If G is colored at random with q colors, then G gets properly colored with probability at least 𝑂( 𝑘 ) . Add to k Proof: Degrees in degeneracy sequence: d1, d2, d3, ... dn di ≤ 2𝑘 = 𝑖 1− 𝑑 𝑖 𝑞 𝑞 𝑑 𝑖 𝑑 𝑖 𝑞 ≥ 4 − 𝑑 𝑖 𝑞 ≥ 4 − 𝑘 8 𝑖 1− 𝑑 𝑖 𝑞 Success probability =

37 Using the Coloring Lemma
Color the vertices of G at random with q colors. By coloring lemma, with probability at least 1 2 𝑂( 𝑘 ) , solution edge graph is properly colored. 1 2 3 q ≤ 5 Cliques ... For each «little» clique, guess which clique it goes to 2 𝑂( 𝑘 ) ≤ 5q «little» cliques total

38 Wrapping up 5-Clustering
Success probability: 1 2 𝑂( 𝑘 ) Time: 2 𝑂( 𝑘 ) Repeating 2 𝑂( 𝑘 ) times gives time 2 𝑂( 𝑘 ) and constant success probability.

39 Derandomization Lemma: Given vertex set V of size n and integer k, can construct in time 2 𝑂( 𝑘 log 𝑘 ) a family f1, f2, ..., ft of colorings, such that t ≤ 2 𝑂( 𝑘 log 𝑘 ) and for every graph with k edges, there is an i such that fi is a proper coloring of G. Instead of trying random colorings, loop over f1, f2, ..., ft. Running time: 2 𝑂( 𝑘 log 𝑘 ) Can get rid of log k factor (unpublished)

40 Feedback Vertex Set below 2n
Feedback Vertex Set (FVS) IN: G, k Q: Is there a set S of ≤ k vertices such that G\S is a forest? Saw a 4knO(1) time algorithm Can we beat 2n? Branching is tricky Next: O(( )n) = O(1.75n) time using 4knO(1) as black box

41 Feedback Vertex Set algorithm
Given n, k, pick integer t ≤ k. Pick a set S of size t uniformly at random, put S in solution. (By deleting S and decreasing parameter by t) Try to extend S to a feedback vertex set of size ≤ k (By running 4knO(1) time algorithm on (G-S, k-t))

42 Analysis max 𝑘≤𝑛 min 𝑡≤𝑘 𝑛 𝑡 𝑘 𝑡 4 𝑘−𝑡 Success probability: 𝑘 𝑡 𝑛 𝑡
Number of subsets of solution of size t Success probability: 𝑘 𝑡 𝑛 𝑡 Number of subsets of size t Running time: 4k-tnO(1) Running time for constant success probability: 𝑛 𝑡 𝑘 𝑡 4 𝑘−𝑡 Given n, consider the worst k: Given n and k pick t so that running time is minimized: max 𝑘≤𝑛 min 𝑡≤𝑘 𝑛 𝑡 𝑘 𝑡 4 𝑘−𝑡 min 𝑡≤𝑘 𝑛 𝑡 𝑘 𝑡 4 𝑘−𝑡

43 Analysis, cont’d For all c > 1, max 𝑘≤𝑛 min 𝑡≤𝑘 𝑛 𝑡 𝑘 𝑡 𝑐 𝑘−𝑡 ≤𝑂( (2− 1 𝑐 ) 𝑛 ) Lemma: Corollary: Feedback Vertex Set in 𝑂( (2− 1 4 ) 𝑛 ) = O(1.75n) time.

44 Generalizing Nothing in the algorithm / analysis was specific to FVS! Look for a set of size k in a universe of size n. If we can extend a set of size t to a solution of size k in time ck-tnO(1) then We can find a solution in time O( (2− 1 c ) n ) Can be fully derandomized.

45 Even faster k-Path Input: G, k, v Question: Is there a k-path that starts at v? Saw (2e)knO(1) time Next: 2knO(1) time

46 Magic algorithm Copy every edge k times, label the copies 1,2,...,k. Give every copy a random integer weight from 1,2,...,2m For each w between 0 and 2mk x = the number of multilabeled k-walks from v of weight exactly w If x is odd, return that G has a k-Path Return that G has no k-Path How to compute x quickly? WTF? Why This Functions?

47 Computing the number of multilabeled walks
Edge labeled, edge weighted, multigraph Input: G, v, k, w Task: Compute the number of multi-labeled k-walks from v T[S, u, t] = Number of S-multilabeled walks from v to u of weight t Vertex Fill out T in time O(2kn2w) Subset of labels Integer weight from 0...w

48 Why Algorithm Works: Isolation Lemma
Isolation Lemma: Let F be a family of sets over a universe V of size n. Assign the elements of v weights from {1...2n} uniformly at random. Then, with probability at least ½, F contains a unique set of minimum weight.

49 Re-visiting the magic Copy every edge k times, label the copies 1,2,...,k. Isolation lemma! Give every copy a random integer weight from 1,2,...,2m For each w between 0 and 2mk x = the number of multilabeled k-walks from v of weight exactly w If x is odd, return that G has a k-Path Will show: Number of bad walks is even! Return that G has no k-Path (Think of multilabeled walks as edge sets) F = family of multi-labeled k-walks from G that correspond to k-paths from v (Never visit same vertex twice) Unique k-walk corresponding to path of minimum weight w

50 The brother of the brother is
Pairing up Bad Walks Same weight! New walk is different from old The brother of the brother is the same walk again

51 Wrapping up k-path in 2k time!
Copy every edge k times, label the copies 1,2,...,k. Unique GOOD multilabeled walk of minimum weight w Give every copy a random integer weight from 1,2,...,2m For each w between 0 and 2mk x = the number of multilabeled k-walks from v of weight exactly w 2k time If x is odd, return that G has a k-Path Unique GOOD multilabeled walk of minimum weight w Return that G has no k-Path k-path in 2k time!

52 Techiques Random Separation Picking Random Solution Vertices
Chromatic Coding Random Separation Techiques Picking Random Solution Vertices Color Coding Mod 2 Counting + Isolation

53 Thank you!


Download ppt "Randomized Parameterized Algorithms (and de-randomizations)"

Similar presentations


Ads by Google