• Nem Talált Eredményt

4.4 The Q-Q case

4.4.2 Running time analysis for algorithm A

Let N(F) denote the set of non-trivial fragments in F. We define the measure µ(F) of a given fragmentationF for (T, T0, S) as follows:

µ(F) = X

Note thatµ(F) =µ(Frev) is trivial, so reversing a fragmentation does not change its measure.

Recall thatFrev is a fragmentation for (Trev, T0rev, S).

Lemma 4.4.12. Let F1, . . . ,Ft,Ft+1 be a series a fragmentations such that for eachi∈[t]

algorithmAobtainsFi+1fromFi by applying a right split at an indexjiviolating Property`i

inFi. LetHi denote the fragment of Fi containingji. of Lemma 4.4.9. LetHi0 be the non-trivial fragment obtained from Hi after the right split at ji. Now, by the choice of ji, Property`i is violated by ji in Fi, but is not violated by any indexj0 preceding ji in Fi. In all cases where`i 6= 8, claim (1) of Lemma 4.4.9 implies that the indices preceding ji cannot violate Property`i in Fi+1, yielding π(Fi, Hi, `i) = 0 butπ(Fi, Hi0, `i) = 1. Considering claims (2) and (3) of Lemma 4.4.9 again, (1) follows.

Observe that ifµ(F1) =µ(Ft), then`i= 8 for everyi∈[t] follows directly from the above discussion. Suppose thatHi is a counterexample for (2), meaning thatHi does not contain

4.4. The Q-Q case 71 the indices of Hi+1. Since Fi+1 is obtained fromFi by a right split, this can only happen ifHi+1 is a non-trivial fragment ofFi different fromHi. Recall that a fragment B contains some index violating Property 8, if and only ifR(A, B) 6=∅ holds for some fragment A in the fragmentation. Hence,π(Fi+1, Hi+1,8) = 0 implies π(Fi, Hi+1,8) = 0.

Since the algorithm always chooses the first index violating some property to branch on,ji

must be the smallest index that is LR-critical for some pair of fragments inFi. Therefore,Hi

must precedeHi+1. But now, the choice ofji+1 indicatesπ(Fi+1, Hi0,8) = 1, whereHi0 is the non-trivial fragment ofFi+1obtained by splittingHiatjiinFi. Together withπ(Fi, Hi,8) = 0 and statements (2) and (3) of Lemma 4.4.9, this showsµ(Fi+1)> µ(Fi), a contradiction.

To prove (3), letH ∈ F1contain everyji. LetP(H) denote the set of non-trivial fragments inF1precedingH. For somei∈[t] and someF ∈P(H), letFidenote the unique non-trivial fragment of Fi that contains some of the indices contained in F. We denote by P Ri(H) those fragmentsF in P(H) for which R(Fi, Hi)6= ∅ holds in Fi. Clearly,P Ri(H)6=∅ for any i ∈ [t] by claim (2), and note also P Ri+1(H) ⊆ P Ri(H). If F ∈ P Ri(H), then we definedi(F) as follows. If L(Fi, Hi) =∅ inFi, then letyiLbe the first index contained inFi

minus one, otherwise letyiL have the value of Lmax(Fi, Hi) inFi. Also, let yiR be the value ofRmin(Fi, Hi) inFi. We setdi(F) =yRi −yLi.

LetA∈P Ri+1(H) denote a non-trivial fragment such thatji is LR-critical for (Ai, Hi).

We showdi+1(A)> di(A). Clearly,ji is either L-critical or R-critical for (Ai, Hi). First, let us assume thatji is L-critical for (Ai, Hi). Observe that the definition of L-critical indices implies that for any vertexv starting atLmax(Ai, Hi) and contained inL(Ai, Hi) inFi, we knowQrightr0 (v)≥ji. SinceFi+1 is obtained by performing the right split atji in Fi, every index of Hi+1 precedes ji, implying that such a v can not be contained in L(Ai+1, Hi+1) in Fi+1. Thus,Lmax(Ai+1, Hi+1)6=Lmax(Ai, Hi), from whichyLi+1 < yiL follows. Therefore, we havedi+1(A)> di(A).

Second, let us assume thatjiis R-critical for (Ai, Hi). Using the definition of R-criticality, implies that for any vertexv starting atRmin(Ai, Hi) and contained in R(Ai, Hi) inFi, we know Qrightr0 (v) ≥ji. Again, we know that every index of Hi+1 precedes ji. From this, we have thatv can not be contained inR(Ai+1, Hi+1) in Fi+1, implyingyi+1R > yRi . Therefore, we havedi+1(A)> di(A) in this case as well.

Now, we claim that 1 ≤ di(A) ≤ σ(A) for any A ∈ P Ri(H). First, it is clear that for any ` < 8, Property ` holds for each index both in Fi and in the reversed fragmenta-tionFirev, as otherwise the algorithm would branch on an index violating Property`. Thus, Lmax(Ai, Hi)≥ Rmin(Ai, Hi) can not happen, as this would mean that there is a conflict-inducing index inHi for (Ai, Hi), violating Property 7. This directly implies 1≤di(A).

Second, assumedi(A) =yiR−yiL > σ(A). This implies thath=yiR−σ(A) is contained inAi, but no vertex ofL(Ai, Hi)∪R(Ai, Hi) starts inh. However, by Properties 3 and 5 foryRi , we know that some vertex in Mr+((yiR)left) = Mr+(hright) ends Hi. Using these properties for hrev in the reversed instance, we obtain that some vertex v in Mr+0(h) must also end in Hi. By Property 5 for h, v must be contained in one of the sets L(Ai, Hi), R(Ai, Hi), X(Ai, Hi). But yLi < h < yRi , so we obtain v ∈ X(Ai, Hi). Therefore, some index in Hi

violates Property 6, a contradiction.

Now, observe that for anyi ∈[t], ji is LR-critical for some (Ai, Hi) withA ∈P Ri(H).

IfA ∈P Ri+1(H) as well, then di+1(A) > di(A). By our bounds on di(A), this yields that there can be at mostσ(A) indicesiwhere ji is LR-critical for (Ai, Hi). (Here we also used that di(A) can not decrease, by its definition.) This clearly implies t ≤ P

FP(H)σ(F) = δ(H).

To finish the proof, we showδ(H)≤k. Letb0be the last index preceding the indices inH, and letb=b0+δ(H). Recall thatφS(Br+0(1, b0)) =Br+(1, b)\S by Proposition 4.4.4. Using that Properties 1 and 3 hold for every index in [m0] and thatBr+(i)6=∅by Proposition 4.1.2

for anyi∈[m], we obtain

Now, we can state the key properties of algorithmA, which prove Theorem 4.3.1.

Lemma 4.4.13. Given an input(G0, G)where|V(G0)|=nand|V(G)|=n+k, algorithmA either produces a reduced input in O(n) time, or branches into at most kO(k3) such that in each branch it either correctly refuses the instance, or outputs an independent subproblem or a necessary set of size at most2k+ 1. Moreover, each branch takesO(n)time.

Proof. Let us overview the steps of algorithm A. First, it tries to apply the reduction rules described in Section 4.3.2. In this phase, it either outputs a reduced input in linear time, or it may branch into at most (4k+ 1)24k(k(7k/2 + 8) + 1) = 2O(k) branches. In each branch it either correctly outputs ’No’, outputs a necessary set of size at most 2, or outputs an independent subproblem having parameter at mostk−1 but at least 1. These steps can be done in linear time, as argued in Section 4.3.2.

If none of the reductions in Section 4.3.2 can be applied, then A first checks whether a reduced input can be output by using Lemma 4.4.2. If not, then it branches into 3 directions, according to whetherS is local, and if not, whether the children ofr0 should be reversed to achieve the properties of Lemma 4.4.1. In the first branch, it outputs a necessary set of size at most 2. In the other two branches, it checks whether the annotated fragmentationAF0

produced in the beginning is proper. While the annotated fragmentation is not proper,A chooses the smallest`and the smallest indexj violating Property `(maybe in the reversed instance), and branches into at most 2(k+1)2−1 directions. In these branches,Aeither mod-ifies the actual annotated fragmentation or stops by outputting an independent subproblem, a necessary set of size at most 2k+ 1, or rejecting.

Let us consider a sequence oftsuch branchings performed byA, and letAF0, AF1, . . . , AFt

be the sequence of annotated fragmentations produced in this process. (We interpret these as annotated fragmentations for (T, T0, S) and not for (Trev, T0rev, S).) Let us call a con-tinuous subsequence S of AF0, AF1, . . . , AFt a segment, if each annotated fragmentation in S has the same number of non-trivial fragments, and S is maximal with respect to this property. By Lemma 4.4.5, the algorithm can reject if there are more than 2k non-trivial fragments in a fragmentation, soAF0, AF1, . . . , AFtcan contain at most 2ksegments.

Let S = AFt1, AFt1+1, . . . , AFt2 be such a segment. Clearly, each AFh (t1 < h ≤ t2) is obtained from AFh1 by performing a right split either in the original or in the reversed instance (the latter meaning thatAFhrev is obtained fromAFhrev1 by a right split).

LetAFpbe the first 9-proper annotated fragmentation in the segment. By Lemma 4.4.12, each subsequence ofAFt1, . . . , AFp where the measure does not increase can have length at mostk. (The measure of an annotated fragmentation is the measure of its fragmentation.) By (2) of Lemma 4.4.12, AFt1 has a non-trivial fragment containing each of those indices for which the algorithm performed a branching (because of Property 8) in someAFh, t1 ≤ h≤p. Taking into account that the number of non-trivial fragments can not exceed 2k, but branchings can also happen in the reversed instance, we obtain that there can be at most 4k maximal subsequences inAFt1, . . . , AFp of length at least 2 where the measure is constant.

Using Lemma 4.4.5, we get thatµ(AFp)≤36k, implyingp≤t1+ 4k2+ 36k.

4.4. The Q-Q case 73 Clearly, A obtains AFp+1, AFp+2, . . . , AFt2 while trying to ensure Property 10, by per-forming right splits in the original instance. Observe that ifAobtains AFh(p+ 1≤h≤t2) by applying a right split at j, then by the choice of j, Property 10 holds for each in-dex j0 ≤ j in any AFh0 where h0 ≥ h. This, together with Lemma 4.4.5 implies that A can perform at most 2k such branchings, implying that t2 ≤ p+ 2k ≤t1+ 4k2+ 38k. Al-together, this impliest≤2k(4k2+ 38k), proving that the maximum length of a sequence of branchings performed by Ain order to obtain a proper annotated fragmentation can be at most 8k3+ 76k2=O(k3).

Essentially, this means that the search tree thatAinvestigates has height at mostO(k3).

Since one branching results in at most 2(k+ 1)2 −1 directions, we obtain that the to-tal number of resulting branches in a run of algorithm A can be bounded by some func-tions f(k) = kO(k3). In each of these branches, if A does not stop, then it has a proper annotated fragmentation (F, U). After this, algorithmAdoes not perform any more branch-ings. Instead, it applies Lemma 4.4.10 repeatedly. If the algorithm reaches a state where Lemma 4.4.10 does not apply, then it outputs a solution in linear time using Lemma 4.4.11.

It is easy to verify that each branch can be performed in linear time. The only non-trivial task is to show that the repeated application of Lemma 4.4.10 can be implemented in linear time, but this easily follows from the fact that none of the conditions of Lemma 4.4.10 can be applied twice for a block [a, b].