Download presentation
Presentation is loading. Please wait.
Published byPiers Wiggins Modified over 9 years ago
1
1 Convex Recoloring of Trees Reuven Bar-Yehuda Ido Feldman
2
2 Convex Coloring A Coloring is Convex if each color induces a block. Convex Coloring Non-Convex Coloring
3
3 Problem Definition Input:Colored Tree (T, ,W) Output:Convex Coloring ’ Cost:Weight of recolored vertices Cost=2
4
4 is a cover if there is a recoloring which changes only vertices from. Coloring Cover
5
5 Formal Definition Input:Weight vector W, Tree T, Coloring . Output:Coloring Cover. Cost: 4 1 3 6 2 5 879 0 1 1 0 0 0 0 00 Cost=2+9=11
6
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
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
8 Previous Results [Snir,Moran]: Dynamic Programming algorithm (EXP) 3 Approximation for trees 2 Approximation for strings
9
9 Our Contribution A 2+ε approximation algorithm for trees Time complexity: poly(n)exp(1/ ε) Faster Dynamic Programming Though still exponential time.
10
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
11 Example: 3-approximation v separates 3 different colors. For every feasible x: v 1 1 1 11 1 0 0
12
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
13 Running Example 4 1 4 1 2 2 5 4 3
14
14 Running Example (2) 0 1 4 11 4 3 4 2
15
15 Running Example (3) 0 0 3 01 3 2 4 1 No More Weight Reductions. Need to calculate optimal cover.
16
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 1 1 1 222 ttt
17
17 Example: (2,3)-seperator 3 2 2 2 1 1 1 4 v 2 colors (, ) are separated to 3 components. 12
18
18 Weight reduction On a (t,d)-separator, assign a weight of 1 to each one of the t∙d vertices. 1 1 1 1 1 1 1 1 1 For every feasible x: 1 1 1 222 ttt At most one color left on ≥2 sides
19
19 Weight Reduction #1 11 22 kk 1 1 1 1 1 1
20
20 Weight Reduction #2 1 2 12 12 1 1 1 1 1 1 K nodes
21
21 Weight Reduction #3 12 12 12 333 1 2 1 1 1 1 1 1 1 11 11 1 3
22
22 Weight Reduction #4 12 12 12 333 444 1 1 1 1 1 1 111 111
23
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
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
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
26 What ’ s Next? We show how to handle light k colorings …
27
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+1. 3 3 2 2 1 1 1 4 v Sep(v,1)=3 Sep(v,3)=2 S=(3,2,2,1)
28
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
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.) 1 2 12 12 K nodes
30
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.) 12 12 12 333 1 2 3
31
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.) 12 12 12 333 444
32
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.) 11 22 kk
33
33 Conclusion We would like to assign colors to connected components. We will assign each color only to components containing it. 1 2 3... Deg(v) 1 2 3 … k-1 1 2 3 1 2.. 1 2 1k254 3 …
34
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
35 Observation 1 v vjvj vivi
36
36 Conclusion 2 v v2v2 v1v1 NewColor(v)=, NewColor(v 2 ) ≠ c c No c c c
37
37 Dynamic Programming - Idea v Recoloring subtree(v) Sum cost of subtrees Add cost of root Reserved Colors Allowed Colors
38
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
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
40 Dynamic Programming – Cont. Lemma: It is enough to scan partitions.
41
41 Summary Total time complexity: Setting we get: Approximation Ratio: Time Complexity:
42
42 Thank you!
43
43 Separated Colors Idea: Enough to recolor v with. 1 1 2 2 3 3 3 4 v vv C v ={,,,, } 123 v
44
44 Good Recoloring A recoloring is good if for every vertex v,. Lemma: An optimal good recoloring is an optimal recoloring.
45
45 Good Recoloring - Proof Step 1:Find an optimal cover
46
46 Good Recoloring – Proof (2) Step 2:Uncolor covered vertices
47
47 Good Recoloring – Proof (3) Step 3: If a vertex is on between 2 c vertices, color it with c
48
48 Good Recoloring – Proof (4) 11 00 Step 4: Recolor other nodes with v This recoloring is good.
49
49 Observation on Good Recolorings, v u
50
50 Observation (cont.) Need to check partitions that for each i:. Denote by GPart the group of such partitions.
51
51 Revised Dynamic Prog.
52
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
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
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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.