1 Convex Recoloring of Trees Reuven Bar-Yehuda Ido Feldman
2 Convex Coloring A Coloring is Convex if each color induces a block. Convex Coloring Non-Convex Coloring
3 Problem Definition Input:Colored Tree (T, ,W) Output:Convex Coloring ’ Cost:Weight of recolored vertices Cost=2
4 is a cover if there is a recoloring which changes only vertices from. Coloring Cover
5 Formal Definition Input:Weight vector W, Tree T, Coloring . Output:Coloring Cover. Cost: Cost=2+9=11
6 Motivation Phylogenetic trees Each node represents a specie Each color represents an attribute “ Real world ” examples are convex Linguistics Strongly NP complete [Moran,Snir] Hardness holds for strings Exponential Algorithms / Polynomial Approximations
7 r-approximation Given a weight vector w, Tree T, Coloring . Minimize w∙x Subject to:x is a coloring cover x is r-approximation if w∙x≤r∙w∙x* An algorithm is r-approximation if for any w,T, it returns an r-approximation.
8 Previous Results [Snir,Moran]: Dynamic Programming algorithm (EXP) 3 Approximation for trees 2 Approximation for strings
9 Our Contribution A 2+ε approximation algorithm for trees Time complexity: poly(n)exp(1/ ε) Faster Dynamic Programming Though still exponential time.
10 The Local Ratio Theorem x is an r-approximation with respect to w 1 x is an r-approximation with respect to w 2 x is an r-approximation with respect to w 1 +w 2 Proof:Let x*, x 1 *, x 2 * opts w.r.t. w, w 1, w 2. w 1 · x r × w 1 x 1 * w 2 · x r × w 2 x 2 * w · x r × (w 1 x 1 * + w 2 x 2 *) r × ( w 1 x* + w 2 x* ) = r × ( w 1 + w 2 ) x*
11 Example: 3-approximation v separates 3 different colors. For every feasible x: v
12 3-aprx algorithm Algorithm MinCR3(T, ,W) If there is no node separating 3 colors Return Optimal(T, ,W) Else, Let V ’ be the set of the corresponding 6 vertices Define Let Return MinCR3(T, ,W-W 1 )
13 Running Example
14 Running Example (2)
15 Running Example (3) No More Weight Reductions. Need to calculate optimal cover.
16 (t,d)-separator v is a (t,d)-separator if in T-{v}, there are t colors such that each appear on at least d components. { d ttt
17 Example: (2,3)-seperator v 2 colors (, ) are separated to 3 components. 12
18 Weight reduction On a (t,d)-separator, assign a weight of 1 to each one of the t∙d vertices For every feasible x: ttt At most one color left on ≥2 sides
19 Weight Reduction # kk
20 Weight Reduction # K nodes
21 Weight Reduction #
22 Weight Reduction #
23 Light Colorings A coloring is light k if it does not contain: (2,k)-separator (k,2)-separator (3,4)-separator (4,3)-separator
24 2+2/(k-1)-aprx algorithm Algorithm MinCR(T, ,W) If is a light k coloring Return SolveLight(T, ,W) Find (t,d)-separator ( ) Let V ’ be the set of it ’ s t∙d vertices Define Let Return MinCR(T, ,W-W 1 )
25 Algorithm Correctness Claim:MinCR returns an -apx Proof: By induction on recursion depth: Base: (Light Coloring) X is optimal. Step: X is an r-aprx w.r.t. W-W 1 (Induction hyp.). Every solution is an r-aprx w.r.t. W 1. Thus, X is an r-aprx w.r.t. to W (LR Theorem).
26 What ’ s Next? We show how to handle light k colorings …
27 Separated colors Sep(v,c) – Number of connected components containing c in T-{v}. For a vertex v, let s i =sep(v,i). Assume wlog s i ≥s i v Sep(v,1)=3 Sep(v,3)=2 S=(3,2,2,1)
28 In a Light Coloring, for any v: s 1 ≤deg(v) s 2 ≤k-1 s 3 ≤3 s 4 ≤2 s k ≤1 Lemma 1 Trivial. There are at most deg(v) components.
29 Otherwise, s 1 ≥s 2 ≥k. Not a light coloring. Contradiction. For every v: s 1 ≤deg(v) s 2 ≤k-1 s 3 ≤3 s 4 ≤2 s k ≤1 Lemma 1 (cont.) K nodes
30 Otherwise, s 1 ≥s 2 ≥s 3 ≥4. Not a light coloring. Contradiction. For every v: s 1 ≤deg(v) s 2 ≤k-1 s 3 ≤3 s 4 ≤2 s k ≤1 Lemma 1 (cont.)
31 Otherwise, s 1 ≥s 2 ≥s 3 ≥s 4 ≥3. Not a light coloring. Contradiction. For every v: s 1 ≤deg(v) s 2 ≤k-1 s 3 ≤3 s 4 ≤2 s k ≤1 Lemma 1 (cont.)
32 Otherwise, s 1 ≥s 2 ≥…≥s k ≥2. Not a light coloring. Contradiction. For every v: s 1 ≤deg(v) s 2 ≤k-1 s 3 ≤3 s 4 ≤2 s k ≤1 Lemma 1 (cont.) kk
33 Conclusion We would like to assign colors to connected components. We will assign each color only to components containing it Deg(v) … k k254 3 …
34 Definitions Color(v) – The color of v. NewColor(v) – The new color of v. OutDeg(v) – The outgoing degree of v. v i – The i ’ th son of v (0=father). Subtree(v) – The subtree rooted at v.
35 Observation 1 v vjvj vivi
36 Conclusion 2 v v2v2 v1v1 NewColor(v)=, NewColor(v 2 ) ≠ c c No c c c
37 Dynamic Programming - Idea v Recoloring subtree(v) Sum cost of subtrees Add cost of root Reserved Colors Allowed Colors
38 Dynamic Programming OPT (v) - the optimal recoloring of Subtree(v), while are reserved colors. OPT ,c (v) - the optimal recoloring of Subtree(v), while are reserved colors, and NewColor(v)=c. Observation:
39 Cost of recoloring a subtree - cost of recoloring subtree(v i ) while i are reserved colors and NewColor(v)=c. v vivi Case 1: Case 2: v vivi
40 Dynamic Programming – Cont. Lemma: It is enough to scan partitions.
41 Summary Total time complexity: Setting we get: Approximation Ratio: Time Complexity:
42 Thank you!
43 Separated Colors Idea: Enough to recolor v with v vv C v ={,,,, } 123 v
44 Good Recoloring A recoloring is good if for every vertex v,. Lemma: An optimal good recoloring is an optimal recoloring.
45 Good Recoloring - Proof Step 1:Find an optimal cover
46 Good Recoloring – Proof (2) Step 2:Uncolor covered vertices
47 Good Recoloring – Proof (3) Step 3: If a vertex is on between 2 c vertices, color it with c
48 Good Recoloring – Proof (4) 11 00 Step 4: Recolor other nodes with v This recoloring is good.
49 Observation on Good Recolorings, v u
50 Observation (cont.) Need to check partitions that for each i:. Denote by GPart the group of such partitions.
51 Revised Dynamic Prog.
52 Complexity Analysis Time complexity for calculating OPT C,c (v) for a node v, every color c and every C: Number of colors Number of options for Calculating the sum
53 Complexity Analysis (Cont.) By scanning the partitions in a order with a constant hamming distance, time per vertex can be reduced to: Summing on all vertices:
54 Weight Reductions Complexity Na ï ve implementation: O(nc) per one reduction, O(n 2 c) total. Could be implemented in O(nc) total. Summing up: O(nc) for weight reduction O(nk 2 2 k ) for DP.