4.5 Algorithm using Cut & Count
4.5.2 Cut & Count
n-time algorithm for all possible combinations ofsandt, i.e., at mostn2 times. We thus obtain the following result:
Theorem 4.4.6. Given a tree decomposition of width at mostω, there exists an algorithm that solves MAXIMUMWEIGHTMINIMALs-tSEPARATORin timeωO(ω)n3.
consistentifv1∈V1andv2 ∈V2implies (v1, v2)∈/E.
This means that a cut(V1, V2)ofV0 is consistent if there are no edges betweenV1 andV2. We fix an arbitrary vertexvinV1. Then, ifG[V]is connected, then there only exists one consistent cut, namely(V1, V2) = (V,∅). Therefore, the number of consistent cuts is odd. Otherwise, ifV does not induce a connected subgraph, the number of consistent cuts is a multiple of two. Therefore, we just need to compute the number of consistent cuts modulo 2 and return yes if the number of consistent cuts is odd, and return no otherwise. the isolation lemma allows us to guarantee (with high probability) that there exists a unique solution (and thus, that we indeed end up with an odd number of consistent cuts).
LetS ⊆2U be a set of solutions. According to [19, 20], the Cut & Count technique is divided into two parts as follows.
• The Cut part: Relax the connectivity requirement by considering the setR ⊇ Sof possibly connected or disconnected candidate solutions. Moreover, consider the setCof pairs(X;C) whereX∈ RandCis a consistent cut ofX.
• The Count part: Isolate a single solution by sampling weights of all elements inU by the isolation lemma. Then, compute|C|modulo 2 using a sub-procedure. Disconnected candidate solutionsX∈ R \Scancel since they are consistent with an even number of cuts. If the only connected candidatex∈ S exists, we obtain the odd number of cuts.
Given a setUand a tree decompositionhX, Ti, the general scheme of Cut & Count is as follows:
Step 1. Set the integer weight for every vertex uniformly and independently at random by w0 :U → {1, . . . ,2|U|}.
Step 2. For each integer weight 0 ≤ W0 ≤ 2|U|2, compute the number of relaxed solutions of weightW0 with consistent cuts modulo 2 on a tree decomposition. Then return yes if it is odd, otherwise no in the root node.
We use the Cut & Count technique to determine whether there exists a connected partition (S, A, B, Q)of weightW so thatAandB are connected. To apply the above scheme, we newly give the following definition of apartial solution. Note that we have to consider two consistent cuts ofAandB.
Definition 4.5.4. Given a nodeiof the tree decomposition ofG, apartial solutionfor that node is a tuple(S∅, SA, SB, SAB, Al, Ar, Bl, Br, Q, w), such that:
• Vi =S∅∪SA∪SA∪SAB∪Al∪Ar∪Bl∪Br∪Q,
• (Al, Ar)is a consistent cut: there exists no edge(u, v)∈Esuch thatu∈Alandv∈Ar,
• (Bl, Br)is a consistent cut: there exists no edge(u, v)∈Esuch thatu∈Blandv∈Br,
• w= Σv∈Sw(v),
• ∀v∈S∅,N(v)∩(Al∪Ar∪Bl∪Br) =∅,
• ∀v∈SA,N(v)∩(Bl∪Br) =∅andN(v)∩(Al∪Ar)6=∅,
• ∀v∈SB,N(v)∩(Bl∪Br)6=∅andN(v)∩(Al∪Ar) =∅and
• ∀v∈SAB,N(v)∩(Bl∪Br)6=∅andN(v)∩(Al∪Ar)6=∅.
• s∈Vi ⇒s∈Al
• t∈Vi ⇒t∈Bl
For each vertexv, we set another weightw0(v)by choosing from{1, . . . ,2|V|}independently at random. We also define the coloring functionc:V → {s∅, sA, sB, sAB, al, ar, bl, br, q}. Now, we give a dynamic programming algorithm that computes the number of relaxed solutions with consistent cuts modulo 2. To compute that, for eachc,wandw0, we define thecountingfunction hi :{s∅, sA, sB, sAB, al, ar, bl, br, q}|Xi|×N×N→Nin each nodeion a nice tree decomposition.
Here, we define the function[p]as follows: ifpis true, then[p] = 1, otherwise[p] = 0.
Leaf node: In a leaf node, we define hi(∅,0,0) = 1, ifS∅ = SA = SB = SAB = Al = Ar =Bl =Br =∅andw, w0 = 0. Otherwise,hi(c, w, w0) = 0.
Introduce vertexvnode: The functionhihas five cases in introduce vertex nodes. Note that we only add one vertexvwithout edges. Thus, ifc(v) ∈ {sA, sB, sAB}, the partial solution is invalid by definition becausevhas no neighbor. Ifc(v) =s∅, vertexvis chosen as a vertex ofS, and we hence add each weightw(v),w0(v)tow,w0, respectively. Moreover,vmust not bes,tbecauses
(resp.,t) should be inAl(resp.,Bl). If not, it is not a connected partition. Similarly, ifc(v) = al (resp.,bl), we check whethervis nott(resp.,s). As forc(v) ∈ {ar, br, q}, we also check whether vis neithersnort. Therefore, we definehiin introduce vertex nodes as follows:
hi(c× {c(v)}, w, w0) :=
[v6=s, t]hj(c, w−w(v), w0−w0(v)) ifc(v) =s∅ [v6=t]hj(c, w, w0) ifc(v) =al [v6=s]hj(c, w, w0) ifc(v) =bl
[v6=s, t]hj(c, w, w0) ifc(v)∈ {ar, br, q}
0 otherwise.
Introduce edge (u, v) node: In introduce edge nodes, we check each state of the endpoints of the edge(u, v)and definefifor each case.
• Ifc(u) = s∅, vertexuhas no neighbor inAandB. Hence, we define the functionhiin this case as follows:
hi(c× {c(u)} × {c(v)}, w, w0) := [c(v)∈ {a/ l, ar, bl, br}]
·hj(c× {s∅} × {c(v)}, w, w0).
• If c(u) = sA, vertex u has neighbors in A but no neighbor in B. In this case, we have two cases. The first case is that u ∈ S∅ and v ∈ A in the child node, because by adding edge (u, v) in the introduce edge (u, v) node, vertex u is moved from S∅ to SA. The other case is that u ∈ SA and v /∈ B in the child node. If v ∈ B, vertex u is in SAB in the parent node. We define hi as follows. Note that only if c(v) ∈ {al, ar}, we sum up two cases. If c(v) ∈ {bl, br}, hi(c× {c(u)} × {c(v)}, w, w0) := 0, otherwise hi(c× {c(u)} × {c(v)}, w, w0) :=hj(c× {sA} × {c(v)}, w, w0).
hi(c× {c(u)} × {c(v)}, w, w0) := [c(v)∈ {al, ar}]hj(c× {s∅} × {c(v)}, w, w0) + [c(v)∈ {b/ l, br}]hj(c× {sA} × {c(v)}, w, w0).
• The case thatc(u) =sB is almost the same as in the above case, however, we swap the roles ofAandB.
hi(c× {c(u)} × {c(v)}, w, w0) := [c(v)∈ {bl, br}]hj(c× {s∅} × {c(v)}, w, w0) + [c(v)∈ {a/ l, ar}]hj(c× {sB} × {c(v)}, w, w0).
• If c(u) = sAB, we consider three cases: u ∈ SA and v ∈ B, u ∈ SB andv ∈ A, and u ∈SAB andvis in an arbitrary set in the child node. For first and second case, vertexuis moved fromSA(resp.,SB) intoSABby adding edge(u, v). Ifu∈SAB,vis allowed to be in any set because a vertex inSAB could connect to all sets. Therefore, we definefias follows:
hi(c× {c(u)} × {c(v)}, w, w0) := [c(v)∈ {bl, br}]hj(c× {sA} × {c(v)}, w, w0) + [c(v)∈ {al, ar}]hj(c× {sB} × {c(v)}, w, w0) + hj(c× {sAB} × {c(v)}, w, w0).
• Ifc(u) ∈ {al, ar}, thenc(v) ∈ {b/ l, br, q}since there is no edge betweenA, BandQby the definition of connected partition. There is also no edge betweenAlandArbecause(Al, Ar) is a consistent cut. Therefore, ifuis inAlorAr, thenvis in the same set asuor is in one of SAandSAB. Note that becauseuis inA,vis not inS∅,SB.
hi(c× {c(u)} × {c(v)}, w, w0) := [c(v) =c(u)]hj(c× {c(u)} × {c(v)}, w, w0) + [c(v)∈ {sA, sAB}]hj(c× {c(u)} × {c(v)}, w, w0).
• The case thatc(u)∈ {bl, br}is almost the same as in the above case, however, we replaceA
byB.
hi(c× {c(u)} × {c(v)}, w, w0) := [c(v) =c(u)]hj(c× {c(u)} × {c(v)}, w, w0) + [c(v)∈ {sB, sAB}]hj(c× {c(u)} × {c(v)}, w, w0).
• Ifc(u) =q, vertexuis inQ. Hence,vmust be inS∅, SA, SB, SAB, orQbecause a vertex in Qhas no neighbor inAandB by the definition of connected partition.
hi(c× {c(u)} × {c(v)}, w, w0) := [c(v)∈ {s∅, sA, sB, sAB, q}]
·hj(c× {c(u)} × {c(v)}, w, w0).
Forget v node: For forget nodes, ifcj(v) ∈ {s∅, sA, sB}, a partial solution does not satisfy the condition of connected partitions because anyv ∈ S must have neighbors of both AandB. For this reason, we only sum up for each statecj(v)∈ {sAB, al, ar, bl, br, q}. The functionhiin forget nodes is defined as follows:
hi(c, w, w0) := X
cj(v)∈{sAB,al,ar,bl,br,q}
hj(c× {cj(v)}, w, w0).
Join node: We denote the coloring and weight for each partial solution ini, j1, j2 byci, cj1, cj2
andwi,wj1, wj2,w0i, wj0
1, w0j
2, respectively. Moreover, for a state subsetL ⊆ {s∅, sA, sB, sAB, al, ar, bl, br, q}, we definec−1(L) as the vertex set such that all vertices satisfyc(v) ∈ L. For a coloringci, we also define the subsetDof tuples of(cj1, cj2)as the combinations of colorings of cj1,cj2 like Section 3 such that:
• ∀v∈c−1i ({s∅, al, ar, bl, br, q}),(cj1(v), cj2(v)) = (ci(v), ci(v)),
• ∀v∈c−1i ({sA}),(cj1(v), cj2(v)) = (sA, s∅),(s∅, sA),(sA, sA),
• ∀v∈c−1i ({sB}),(cj1(v), cj2(v)) = (sB, s∅),(s∅, sB),(sB, sB), and
• ∀v∈c−1i ({sAB}),(cj1(v), cj2(v)) = (sAB, s∅),(sAB, sA),(sAB, sB), (sAB, sAB),(s∅, sAB),(sA, sAB),(sB, sAB),(sA, sB),(sB, sA).
LetS∗be the vertex subsetc−1i ({s∅, sA, sB, sAB}). To sum up all combinations of vertex states and weights for counting, we define the function hi. If D = ∅, we definehi(ci, wi, wi0) := 0.
Otherwise,
hi(ci, wi, wi0) := X
wj1+wj2
=wi+w(S∗)
X
w0 j1+w0
j2
=w0 i+w0(S∗)
X
(c∗j
1,c∗j
2)∈D
hj1(c∗j1, wj1, w0j1)hj2(c∗j2, wj2, w0j2).
From now, we analyze the running time of this algorithm. In leaf, introduce vertex, introduce edge, and forget nodes, we can computefi for each coloringcand weightw, w0 inO(1)-time be-cause we only useO(1)-operations. Therefore, the total running time for them isO∗(9ω·W ·W0).
However, in join nodes, we sum up all weight combinations and coloring combinations satisfying some conditions. There are 21 coloring combinations for each vertex andW ·W0 weight combina-tions. Therefore, we compute allfi’s in a join node in timeO∗(21ω·W2). Note that by definition, O(W02)is a polynomial factor.
Theorem 4.5.5. Given a tree decomposition of width at mostω, there exists a Monte-Carlo algo-rithm that solves the decision version of MAXIMUM WEIGHT MINIMAL s-tSEPARATORin time O∗(21ω·W2). It cannot give false positives and may give false negatives with probability at most 1/2.
Using the convolution technique [110], we can obtain a faster Monte-Carlo algorithm. The technique helps to speed up the computation for join nodes. First, we set the new coloring ˆ
c:V → {sA¯B¯, sA¯, sB¯, sall, al, ar, bl, br, q}. The statesA¯B¯ represents that a vertexvis inSand has no neighbor ofAandB. The statesA¯ (resp.,sB¯) represents a vertexvis inSand has no neighbor ofA(resp.,B), respectively. Finally, the statesallrepresents a vertexvis inSwithout constraints.
Then, we show the following lemma to transform betweencandˆc.
Lemma 4.5.6. Letibe a node of a tree decomposition andhi(c, w, w0) be a counting function to count the number of partial solutions of MAXIMUM WEIGHT MINIMALs-tSEPARATORof each weightw, w0, corresponding to each coloringc,cˆof a nodei. Then we can transform from one coloring to another coloring for each function without loss of information. Moreover, it is computed inO(W ·W0·9ω· |Xi|).
Proof: This proof scheme follows [110]. We consider the immediate`-th step in the transformation.
Forhi(c× {c(v)} ×c, w, wˆ 0),vis a vertex which turns into the state of another coloring in the`-th step, andcis the partial coloring of size`−1andˆcis also the partial coloring of size|Xi| −`. Here, for simplicity, we denotehi(c× {c(v)} ׈c, w, w0)andhi(c× {ˆc(v)} ׈c, w, w0)byhi(c(v))and hi(ˆc(v)).
Sincehiis the number of partial solutions with a consistent cut, the transformation fromctoˆc ofhiin`-th step is as follows:
- hi(sA¯B¯) =hi(s∅)
- hi(sA¯) =hi(s∅) +hi(sB) - hi(sB¯) =hi(s∅) +hi(sA)
- hi(sall) =hi(s∅) +hi(sA) +hi(sB) +hi(sAB).
Conversely, we can transform fromcˆtocas follows:
- hi(s∅) =hi(sA¯B¯)
- hi(sA) =hi(sB¯)−hi(sA¯B¯) - hi(sB) =hi(sA¯)−hi(sA¯B¯)
- hi(sAB) =hi(sall)−hi(sA¯)−hi(sB¯) +hi(sA¯B¯).
These equations follow from equations of the transformation fromctoc.ˆ
For each of the coloringsc,ˆc, each transformation can be performed inO(|Xi|)-steps. Thus, the total running time of each direction isO(W ·W0·9ω· |Xi|).
Therefore, we first transform the original coloringcto the new coloringcˆinO(W·W0·9ω·|Xi |)-time. Then we compute the following functionhifor the new coloringˆcinO(9ω·W2)-time:
hi(ˆc, w,wi0) := X
wj1+wj2=wi+w( ˆS∗)
X
w0j
1+w0j
2=wi0+w0( ˆS∗)
hj1(ˆc, wj1, w0j1)hj2(ˆc, wj2, wj02),
whereSˆ∗ = ˆc−1({s∅, sA, sB, sAB}) ⊆V. Note thatˆci,cˆj1,ˆcj2 are the same coloring. Finally, we transformˆctoc. Thus, total running time of this algorithm isO∗(9ω·W2).
s∅ sA sB sAB al ar bl br q s∅ s∅ sA sB sAB
sA sA sA sAB sAB
sB sB sAB sB sAB
sAB sAB sAB sAB sAB
ar ar
al al
br br
bl bl
q q
Table 4.2. Combinations of the original coloring in join node
sall sA¯ sB¯ sA¯B¯ al ar bl br q sall sall
sA¯ sA¯
sB¯ sB¯
sA¯B¯ sA¯B¯
ar ar
al al
br br
bl bl
q q
Table 4.3. Combinations of the new coloring in join node
Theorem 4.5.7. Given a tree decomposition of width at mostω, there exists a Monte-Carlo algo-rithm that solves the decision version of MAXIMUM WEIGHT MINIMAL SEPARATORand MAXI
-MUM WEIGHT MINIMALs-tSEPARATORin timeO∗(9ω·W2). It cannot give false positives and may give false negatives with probability at most1/2. If the input graph is unweighted, the running time is9ωnO(1).
As usual for this type of algorithm, the probability of a false negative can be made arbitrarily small by repeating the algorithm.