430 likes | 594 Views
Convex Recoloring of Trees. Reuven Bar-Yehuda Ido Feldman. Convex Coloring. A Coloring is Convex if each color induces a block. Convex Coloring. Non-Convex Coloring. Problem Definition. Input: Colored Tree (T, ,W) Output: Convex Coloring ’ Cost: Weight of recolored vertices.
E N D
Convex Recoloring of Trees Reuven Bar-Yehuda Ido Feldman
Convex Coloring • A Coloring is Convex if each color induces a block. Convex Coloring Non-Convex Coloring
Problem Definition • Input: Colored Tree (T,,W) • Output: Convex Coloring ’ • Cost: Weight of recolored vertices Cost=2
Coloring Cover • is a cover if there is a recoloring which changes only vertices from .
0 1 0 0 0 0 1 0 0 Formal Definition • Input: Weight vector W, Tree T, Coloring . • Output: Coloring Cover . • Cost: 1 Cost=2+9=11 2 3 4 5 6 7 8 9
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
r-approximation • Given a weight vector w, Tree T, Coloring . Minimizew∙x Subject to:x is a coloring cover • x is r-approximationif w∙x≤r∙w∙x* • An algorithm is r-approximation if for any w,T, it returns an r-approximation.
Previous Results • [Snir,Moran]: • Dynamic Programming algorithm (EXP) • 3 Approximation for trees • 2 Approximation for strings
Our Contribution • A 2+ε approximation algorithm for trees • Time complexity: poly(n)exp(1/ ε) • Faster Dynamic Programming • Though still exponential time.
The Local Ratio Theorem x is an r-approximation with respect to w1 x is an r-approximation with respect to w2 x is an r-approximation with respect to w1+w2 Proof: Let x*, x1*, x2* opts w.r.t. w, w1, w2. w1 · x r ×w1x1* w2 · x r ×w2x2* w · x r ×(w1x1*+ w2x2*) r ×(w1 x* + w2 x*) = r ×(w1+ w2 )x*
1 1 1 1 0 1 1 0 Example: 3-approximation • v separates 3 different colors. • For every feasible x: v
3-aprx algorithm Algorithm MinCR3(T,,W) If there is no node separating 3 colors ReturnOptimal(T,,W) Else, Let V’ be the set of the corresponding 6 vertices Define Let Return MinCR3(T,,W-W1)
Running Example 3 1 2 1 2 4 5 4 4
Running Example (2) 2 0 1 1 1 4 4 4 3
Running Example (3) 1 0 0 0 1 4 3 3 2 No More Weight Reductions. Need to calculate optimal cover.
t t t 1 1 1 2 2 2 (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
v Example: (2,3)-seperator • 2 colors ( , ) are separated to 3 components. 1 3 2 1 2 1 2 4 1 2
1 1 1 t t t 1 1 1 1 1 1 2 2 2 1 1 1 Weight reduction • On a (t,d)-separator, assign a weight of 1 to each one of the t∙d vertices. • For every feasible x: At most one color left on ≥2 sides
1 1 1 1 1 1 Weight Reduction #1 1 1 2 2 k k
1 1 1 1 1 1 Weight Reduction #2 K nodes 2 1 1 2 1 2
1 1 1 1 1 1 1 1 1 1 1 1 Weight Reduction #3 1 2 1 2 1 2 1 2 3 3 3 3
1 1 1 1 1 1 1 1 1 1 1 1 Weight Reduction #4 4 4 4 1 2 1 2 1 2 3 3 3
Light Colorings • A coloring is lightk if it does not contain: • (2,k)-separator • (k,2)-separator • (3,4)-separator • (4,3)-separator
2+2/(k-1)-aprx algorithm Algorithm MinCR(T,,W) If is a lightk coloring ReturnSolveLight(T,,W) Find (t,d)-separator ( ) Let V’ be the set of it’s t∙d vertices Define Let Return MinCR(T,,W-W1)
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-W1(Induction hyp.). • Every solution is an r-aprx w.r.t. W1. • Thus, X is an r-aprx w.r.t. to W (LR Theorem).
What’s Next? We show how to handle lightkcolorings…
v Separated colors • Sep(v,c)– Number of connected components containing c in T-{v}. • For a vertex v, let si=sep(v,i). • Assume wlog si≥si+1. 1 3 Sep(v,1)=3 Sep(v,3)=2 S=(3,2,2,1) 2 1 2 1 3 4
Lemma 1 • In a Light Coloring, for any v: • s1≤deg(v) • s2≤k-1 • s3≤3 • s4≤2 • sk≤1 Trivial. There are at most deg(v) components.
K nodes 2 1 1 2 1 2 Lemma 1 (cont.) • For every v: • s1≤deg(v) • s2≤k-1 • s3≤3 • s4≤2 • sk≤1 Otherwise, s1≥s2≥k. Not a light coloring. Contradiction.
1 2 1 2 1 2 1 2 3 3 3 3 Lemma 1 (cont.) • For every v: • s1≤deg(v) • s2≤k-1 • s3≤3 • s4≤2 • sk≤1 Otherwise, s1≥s2≥s3≥4. Not a light coloring. Contradiction.
4 4 4 1 2 1 2 1 2 3 3 3 Lemma 1 (cont.) • For every v: • s1≤deg(v) • s2≤k-1 • s3≤3 • s4≤2 • sk≤1 Otherwise, s1≥s2≥s3≥s4≥3. Not a light coloring. Contradiction.
1 1 2 2 k k Lemma 1 (cont.) • For every v: • s1≤deg(v) • s2≤k-1 • s3≤3 • s4≤2 • sk≤1 Otherwise, s1≥s2≥…≥sk≥2. Not a light coloring. Contradiction.
1 2 3 ... Deg(v) 1 2 3 … k-1 1 2 3 1 2 1 2 .. 1 2 … 3 k 5 4 2 1 Conclusion • We would like to assign colors to connected components. • We will assign each color only to components containing it.
Definitions • Color(v)– The color of v. • NewColor(v)– The new color of v. • OutDeg(v) – The outgoing degree of v. • vi– The i’th son of v (0=father). • Subtree(v) – The subtree rooted at v.
Observation 1 v vi vj
No No No c c c Conclusion 2 NewColor(v)= , NewColor(v2)≠ c v c v1 v2
Reserved Colors Allowed Colors Dynamic Programming - Idea Recoloring subtree(v) • Sum cost of subtrees • Add cost of root v
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:
Case 1: Case 2: v v vi vi Cost of recoloring a subtree - cost of recoloring subtree(vi) while iare reserved colors and NewColor(v)=c.
Lemma: It is enough to scan partitions. Dynamic Programming – Cont.
Summary • Total time complexity: • Setting we get: • Approximation Ratio: • Time Complexity: