#
The Parameterized Complexity of the Rainbow Subgraph Problem^{ †}

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

**Instance:**An undirected graph G = (V, E), an edge coloring χ : E → {1, …, p} for some p ≥ 1, and an integer k ≥ 0.

**Question:**Is there a subgraph G′ of G that contains each edge color exactly once and has at most k vertices?

#### 1.1. Related Work

^{p}·Δ

^{2}

^{p}·n

^{O}

^{(1)}, where n is the order of the input graph and Δ is the maximum vertex degree of the input graph. This is the only previous fixed-parameter algorithm for MINIMUM RAINBOW SUBGRAPH that we are aware of. There are, however, several results on the parameterized complexity of PARSIMONY HAPLOTYPING [7–9]. RAINBOW SUBGRAPH is also a special case of SET COVER WITH PAIRS [10] which, in graph-theoretic terms, corresponds to the case where the input is a multigraph with vertex weights and the aim is to find a minimum-cost rainbow cover.

#### 1.2. Our Contributions

- p: number of colors;
- k: number of vertices in the solution;
- ℓ := n − k: number of vertex deletions to obtain a solution;
- Δ: maximum vertex degree;
- Δ
_{C}:= max_{υ∈}_{V}|{c | ∃{u, υ} ∈ E : χ({u, υ}) = c}|: maximum color degree; - q: maximum number of times any color occurs in the input graph.

## 2. Preliminaries

^{O}

^{(1)}time, where f is an arbitrary computable function. A data reduction (rule) is a polynomial-time self-reduction for a parameterized problem, that is, it replaces in polynomial time an instance (I, x) with an instance (I′, x′) such that I′ has a solution with respect to the new parameter x′ if and only if I has a solution with respect to the original parameter x; we say that the rule is correct when this property holds. We say that an instance is reduced with respect to a reduction rule if the rule does not affect the instance. If the size of I′ depends only on some function of x, we say that we have a problem kernel with respect to parameter x.

^{O}

^{(1)}time for some function f and maps the parameter x to a new parameter x′ that is bounded by some function of x.

**Observation 1.**Let G′ = (V′, E′) be a solution for a RAINBOW SUBGRAPH instance with G = (V, E). If there are two vertices u, υ in V′ such that {u, υ} ∈ E but {u, υ} ∉ E′, then there is a solution G″ that does contain the edge {u, υ} and has the same number of vertices.

## 3. Parameterization by Color Occurrences

**Instance:**An undirected graph H = (W, F) in which every vertex has degree three.

**Task:**Find a minimum-cardinality vertex cover of G.

**Theorem 1.**MINIMUM RAINBOW SUBGRAPH is APX-hard even when the input is a properly edge-colored path in which every color occurs at most twice.

**Proof.**Given an instance H = (W = {w

_{1}, …, w

_{n}}, F) of MINIMUM VERTEX COVER IN CUBIC GRAPHS, construct an edge-colored path G = (V, E) as follows. The vertex set is V := {υ

_{1}, …, υ

_{16}

_{n}

_{+2}}. The edge set is E := {{υ

_{i}, υ

_{i}

_{+1}} | 1 ≤ i ≤ 16n + 1}, that is, vertices with successive indices are adjacent. It remains to specify the edge colors. Herein, we use u

^{*}to denote unique colors, that is, if an edge is u

^{*}-colored, then it receives an edge color that does not appear anywhere else in G. In addition to these unique colors, introduce five colors for each vertex of H, that is, for each w

_{i}∈ W create edge colors c

_{i}, ${{c}^{\prime}}_{i}$, ${{c}^{\u2033}}_{i}$, x

_{i}, and y

_{i}. The colors c

_{i}, ${{c}^{\prime}}_{i}$, and ${{c}^{\u2033}}_{i}$ are “filling” colors which are needed because G is connected. Furthermore, for each edge f

_{i}∈ F introduce a unique edge color ϕ

_{i}.

_{1}and υ

_{2}is u

^{*}-colored, the edge between υ

_{2}and υ

_{3}is c

_{1}-colored, and so on. The u

^{*}-colors are unique and thus occur only once in G. Consequently, both endpoints of these colors are contained in every solution.

_{i}in H color 10 edges in G according to the edges that are incident with w

_{i}. More precisely, for each w

_{i}color the edges from υ

_{6}

_{n}

_{+2+10(}

_{i−}

_{1)}to υ

_{6}

_{n}

_{+2+10}

_{i}. We call the subpath of G with these vertices the w

_{i}-part of G. Let {f

_{r}, f

_{s}, f

_{t}} denote the set of edges incident with w

_{i}. Then color the edges between υ

_{6}

_{n}

_{+2+10(}

_{i−}

_{1)}and υ

_{6}

_{n}

_{+2+10}

_{i}by the following sequence.

_{i}-part to “cover” the colors corresponding to the edges incident with w

_{i}. If we do so, then the solution has two connected components in the w

_{i}-part. Otherwise, it is sufficient to include one connected component from the w

_{i}-part. Since the solution graph is acyclic and the number of edges in a minimal solution is fixed, the number of connected components in the solution and its order are equal up to an additive constant.

^{*}be an optimal vertex cover for the MINIMUM VERTEX COVER IN CUBIC GRAPHS instance and let G

^{*}be an optimal solution to the constructed MINIMUM RAINBOW SUBGRAPH instance.

^{*})| = O(|S

^{*}|). As observed above, the number of colors p in G is O(n + |F |) and thus |V (G

^{*})| ≤ 2p = O(n + |F|). Clearly, S

^{*}contains at least |F |/3 vertices, since every vertex in H covers at most three edges. Moreover, since H is cubic we have n < 2|F | and thus |S

^{*}| = Θ(n + |F |). Consequently, |V (G

^{*})| = O(|S

^{*}|).

^{*}|. Thus, the differences between the solution sizes in the MINIMUM VERTEX COVER IN CUBIC GRAPHS instance and in the MINIMUM RAINBOW SUBGRAPH instance are essentially the same.

_{i}, ${{c}^{\prime}}_{i}$, or ${{c}^{\u2033}}_{i}$ such that its endpoints are not among the first 6n + 2 vertices, then remove this edge from G′ and add the uniquely defined edge with the same color whose endpoints are among the first 6n + 2 vertices. As observed above, each of these first vertices is contained in every solution and therefore also in G′. Due to Observation 1, this modification thus does not increase the order of G′ and maintains that G′ is a solution. Hence, we assume from now on that G′ contains all of the first 6n + 1 edges of G and no other edges of color c

_{i}, ${{c}^{\prime}}_{i}$, or ${{c}^{\u2033}}_{i}$. This implies that each connected component of G′ is either fully contained in the first part or fully contained in some w

_{i}-part (since the first edge of each such part has a c-color). Moreover, every w

_{i}-part contains at least one connected component of G′, as the colors x

_{i}and y

_{i}occur only in this part. Therefore, G′ has n + 1 + x components for some x ≥ 0. Since G′ is acyclic, the order of G′ thus is p + n + 1 + x.

_{i}-part of G. Let {f

_{r}, f

_{s}, f

_{t}} denote the edges of H that are incident with w

_{i}. If one of the connected components of G′ that is contained in the w

_{i}-part contains an edge with color ϕ

_{r}, ϕ

_{s}, or ϕ

_{t}, then add w

_{i}to S′.

_{i}-part of G such that w

_{i}∈ S′. By the discussion above, the connected components of G′ that are contained in the w

_{i}-part of G do not contain edges with color c

_{i}, ${{c}^{\prime}}_{i}$, or ${{c}^{\u2033}}_{i}$. Hence, these connected components are subgraphs of the following graph that has three connected components:

_{i}, y

_{i}, and one of the other three colors ϕ

_{r}, ϕ

_{s}, and ϕ

_{t}has at least two connected components. Hence, for each w

_{i}∈ S′, G′ has at least two connected components in the w

_{i}-part. Further, for each other w

_{i}-part, G′ has at least one connected component. Finally, G′ has one further connected component consisting of the first 6n + 1 edges. Altogether, the number of connected components thus is at least n + 1 + |S′| and thus |S′| ≤ x.

_{j}∈ F at least one w

_{i}-part such that G′ contains an edge with color ϕ

_{j}from this part. By the construction of S′, we have w

_{i}∈ S′. Summarizing, we have shown that if there is a solution G′, then it has p + 1 + n + x vertices for some x ≥ 0 and from such a solution we can construct a vertex cover S′ of size at most x.

^{*}|. We show that there is a solution Ĝ to G which needs at most |V (G′)| − τ vertices. Construct Ĝ as follows. For each edge f

_{i}∈ F select an arbitrary vertex of S

^{*}that is incident with f

_{i}. Then, add the edge with color ϕ

_{i}in the subpath of G that corresponds to w

_{i}and its endpoints to Ĝ. For each subpath where at least one edge has been added in this way, add the first x- and y-edge and its endpoints to Ĝ. For all other subpaths, add the second x- and y-edge to Ĝ. Finally, add the first 6n + 1 edges of G plus their endpoints to Ĝ. Then, Ĝ contains p edges, one for each color. The number of connected components in Ĝ is 1 + 2|S

^{*}| + n − |S

^{*}|, hence, the number of vertices in Ĝ is p + 1 + |S

^{*}| + n. Consequently, we have

^{*}has at most as many vertices as Ĝ, and thus

## 4. Parameterization by Number of Colors

#### 4.1. Hardness on Bipartite Graphs

**Theorem 2.**MINIMUM RAINBOW SUBGRAPH is W[1]-hard with respect to the number of colors p, even if the input graph is 2-degenerate and bipartite.

**Proof.**We give a parameterized reduction from the following well-known problem:

**Instance:**An undirected graph G = (V, E) with proper vertex coloring χ

_{V}: V →{1, …, p

_{V}}.

**Question:**Does G have a clique of order p

_{V}?

_{V}(u) ≠ χ

_{V}(υ). MULTICOLORED CLIQUE is W[1]-complete with respect to parameter p

_{V}[16].

_{V}) be an instance of MULTICOLORED CLIQUE. We construct a bipartite edge-colored graph G′ with vertex set initialized with V as follows. First, for every edge {u, υ} of G add to G′ a path of length two between u and υ where the middle vertex of this path is a new vertex ω

_{{}

_{u,v}

_{}}. Call the union of all middle vertices V

_{E}. Then, for each pair of vertex colors i and j of G create two new edge colors c

_{i,j}and c

_{j,i}. For each edge {u, υ} of G where χ

_{V}(u) = i and χ

_{V}(υ) = j, color the edge {u, ω

_{{}

_{u,v}

_{}}} with color c

_{i,j}and the edge {v, ω

_{{}

_{u,v}

_{}}} with color c

_{j,i}. This completes the construction of G′. Note that G′ is 2-degenerate and that it has $2\left(\begin{array}{l}{p}_{V}\hfill \\ 2\hfill \end{array}\right)$ edge colors overall. We now show the equivalence of the instances.

_{V}in G. Since χ

_{V}is a proper coloring of G, the vertices in S have p

_{V}pairwise different colors. Hence, the subgraph of G′ that is induced by S ∪ {ω

_{{}

_{u,v}

_{}}| {u, υ} ⊆ S} has $2\left(\begin{array}{l}{p}_{V}\hfill \\ 2\hfill \end{array}\right)$ edges which have pairwise different colors.

_{i,}

_{1}and c

_{1}

_{,i}is covered, S′ has at least one vertex from V for each color i, together at least p

_{υ}vertices. Moreover, S′ has at least $\left(\begin{array}{l}{p}_{V}\hfill \\ 2\hfill \end{array}\right)$ vertices from V

_{E}: we need at least $2\left(\begin{array}{l}{p}_{V}\hfill \\ 2\hfill \end{array}\right)$ edges to collect all colors, each edge contains exactly one vertex from V

_{E}, and each vertex in V

_{E}occurs in at most two edges. Thus, there are exactly p

_{υ}vertices from V and exactly $\left(\begin{array}{l}{p}_{V}\hfill \\ 2\hfill \end{array}\right)$ vertices from V

_{E}in S′. In order to cover the $2\left(\begin{array}{l}{p}_{V}\hfill \\ 2\hfill \end{array}\right)$ colors, each vertex in V

_{E}needs to have degree two in G′[S′]; since such a vertex corresponds to an edge in G, we have $\left(\begin{array}{l}{p}_{V}\hfill \\ 2\hfill \end{array}\right)$ edges in G[V ∩ S′], and we have a clique of size p

_{V}. □

#### 4.2. Degree-Bounded Graphs

^{2})

^{p}· n

^{O}

^{(1)}time. We show an improved bound of O((4Δ − 4)

^{p}· Δn

^{2}). The algorithm by Katrenič and Schiermeyer [4] works by enumerating all connected rainbow subgraphs in O(Δ

^{2}

^{p}· np) time and finding a solution via dynamic programming. We also employ enumeration followed by dynamic programming, but enumerate only connected induced subgraphs. For this, we use the following lemma.

**Lemma 1.**([17], Lemma 2) Let G be a graph with maximum degree Δ and let υ be a vertex in G. There are at most (4Δ − 4)

^{k}connected induced subgraphs of G that contain υ and have order at most k. Furthermore, these subgraphs can be enumerated in O((4Δ − 4)

^{k}· n) time.

**Instance:**A set family $\mathcal{C}$ with weight function w : $\mathcal{C}\to \{0,\dots ,W\}$.

**Task:**Find a minimum-weight subfamily $\mathcal{S}\subseteq \mathcal{C}$ such that each element of $U:={\cup}_{{C}_{i}\in \mathcal{C}}{C}_{i}$ occurs in at least one set in $\mathcal{S}$.

**Theorem 3.**Let (G, χ) be an instance of MINIMUM RAINBOW SUBGRAPH with p colors and maximum vertex degree Δ. An optimal solution of (G, χ) can be computed in O((4Δ − 4)

^{p}· Δn

^{2}) time.

**Proof.**Let (G, χ) be an instance of MINIMUM RAINBOW SUBGRAPH and let k′ be the maximum order of a connected component of a solution. By Lemma 1, we can enumerate in O((4Δ − 4)

^{k}

^{′}· n

^{2}) time all connected induced subgraphs of order at most k′, and in particular all subgraphs induced by the connected components of a solution to G. By interleaving the construction of the set of colors occurring in the current subgraph with the graph enumeration, we can generate the MINIMUM-WEIGHT SET COVER instance in the same time bound.

^{p}, this yields a bound of O(4

^{p}p). Because connected components of a solution are rainbow, we can assume k′ ≤ p + 1 (a connected graph with m edges has at most m + 1 vertices) and obtain O((4Δ − 4)

^{p}

^{+1}n

^{2}+ 4

^{p}p) time. For Δ ≥ 2, this running time is dominated by the enumeration step, yielding the desired bound. □

^{|U|}(|U| · W )

^{O}

^{(1)}time, we will employ a variant of fast subset convolution [18], using the following lemma due to Björklund et al. [19].

**Lemma 2.**[19] Consider a set U and two mappings f, g : 2

^{U}→ {0, …, W}. The mapping (f * g) : 2

^{U}→ {0, …, 2W} where for every U′ ⊆ U

^{|U|}· |U|

^{3}W log

^{2}(|U| · W)) time.

^{2}N) on the running time of integer multiplication of two N-bit numbers. Better bounds are known [20].)

**Instance:**A set family $\mathcal{C}=\{{C}_{1},\dots ,{C}_{m}\}$ with weight function $w:\mathcal{C}\to \{0,\dots .W\}$.

**Task:**Find a minimum-weight subfamily $\mathcal{S}\subseteq \mathcal{C}$ such that each element of $U:={\cup}_{{C}_{i}K\in \mathcal{C}}{C}_{i}$ occurs in exactly one set in $\mathcal{S}$.

**Lemma 3.**MINIMUM-WEIGHT EXACT COVER can be solved in O(2

^{|U|}· |U|

^{3}·W log |U| log

^{2}(|U| · W )) time.

**Proof.**We define an x-cover of a subset U′⊆ U to be a minimum-weight subfamily ${\mathcal{C}}^{\prime}\subseteq \mathcal{C}$ containing at most x sets such that each element of U′ occurs in exactly one set of ${\mathcal{C}}^{\prime}$ and ${\cup}_{{C}_{i}\in {\mathcal{C}}^{\prime}}{C}_{i}={U}^{\prime}$. In these terms, MINIMUM-WEIGHT EXACT COVER is to find a |U|-cover for U (since every exact cover contains at most |U| sets).

^{U}→ {0, …, W} and let initially Q[C

_{i}] = w(C

_{i}) for ${C}_{i}\in \mathcal{C}$ and Q[U′] = ∞ for the remaining U′ ⊆ U. Now let Q

^{x}denote the mapping resulting from x consecutive convolutions of Q, that is, Q

^{0}= Q and Q

^{x}

^{+1}is the convolution of Q

^{x}. We prove by induction on x that for all U′ ⊆ U and all x ≥ 0, Q

^{x}[U′] is the minimum weight of a 2

^{x}-cover for U′ if such a cover exists and Q

^{x}[U′] = ∞ otherwise. This implies in particular that ${Q}^{\lceil {\mathrm{log}}_{2}|U|\rceil}$ [U] is the weight of an optimal solution to $\mathcal{C}$, if a solution exists.

^{0}= Q meets the claim. Now assume that Q

^{x−}

^{1}[U′] is the minimum weight of a 2

^{x−}

^{1}-cover for U′ ⊆ U if such a cover exists, and Q

^{x−}

^{1}[U′] = ∞ otherwise. Now let ${\mathcal{C}}^{\prime}$ be a 2

^{x}-cover for some U′ ⊆ U. Let ${\mathcal{C}}_{\alpha},{\mathcal{C}}_{\beta}\subseteq {\mathcal{C}}^{\prime}$ be disjoint subfamilies such that ${\mathcal{C}}_{\alpha}\cup {\mathcal{C}}_{\beta}={\mathcal{C}}^{\prime}$, $|{\mathcal{C}}_{\alpha}|\le {2}^{x-1}$, and $|{\mathcal{C}}_{\beta}|\le {2}^{x-1}$. (If $|{\mathcal{C}}^{\prime}|=1$, then ${\mathcal{C}}_{\alpha}={\mathcal{C}}^{\prime}$ and ${\mathcal{C}}_{\beta}=\varphi $). Let ${U}_{\alpha}:={\cup}_{{C}_{i}\in {\mathcal{C}}_{\alpha}}$ C

_{i}and ${U}_{\beta}:={\cup}_{{C}_{i}\in {\mathcal{C}}_{\beta}}$ C

_{i}. Now ${\mathcal{C}}_{\alpha}$ is a 2

^{x−}

^{1}-cover for U

_{α}: it covers each element of U

_{α}exactly once, and if there was an exact cover with lower weight, we could combine it with ${\mathcal{C}}_{\beta}$ to get an exact cover for ${\cup}_{{C}_{i}\in {\mathcal{C}}_{\beta}}$ with lower weight than ${\mathcal{C}}^{\prime}$, contradicting that ${\mathcal{C}}^{\prime}$ is a 2

^{x}-cover. The same holds for ${\mathcal{C}}_{\beta}$. Hence, ${Q}^{x-1}[{U}_{\alpha}]=w({\mathcal{C}}_{\alpha})$ and ${Q}^{x-1}[{U}_{\beta}]=w({\mathcal{C}}_{\beta})$, therefore $w({\mathcal{C}}^{\prime})=Q[{U}_{\alpha}]+Q[{U}_{\beta}]$, and due to the minimality of $w({\mathcal{C}}^{\prime})$ we obtain (by convolution) ${Q}^{x}[{U}^{\prime}]={\mathrm{min}}_{{U}^{\u2033}\subseteq {U}^{\prime}}(Q[{U}^{\u2033}]+Q[{U}^{\prime}\backslash {U}^{\u2033}])=w({\mathcal{C}}^{\prime})$. So Q

^{x}[U′] is the weight of a 2

^{x}-cover for U′. If no 2

^{x}-cover for U′ exists, then there is no U″ ⊆ U′ such that Q

^{x−}

^{1}[U″] ≠ ∞ and Q

^{x−}

^{1}[U′\U″] ≠ ∞, hence Q

^{x}[U′] = ∞.

_{2}|U|⌉ convolutions of Q. Applying Lemma 2 with f = g = Q, each convolution can be computed in O(2

^{|U|}|U|

^{3}· W log

^{2}(|U| · W)) time. Retrieving the solution family takes O(2

^{|U|}|U|) time, so we obtain an overall running time of O(2

^{|U|}·|U|

^{3}·W log |U| log

^{2}(|U|·W)).

**Lemma 4.**MINIMUM-WEIGHT SET COVER can be solved in$O(|U|\cdot |\mathcal{C}|+{2}^{|U|}|U{|}^{3}\cdot W\mathrm{log}|U|{\mathrm{log}}^{2}(|U|\cdot W))$ time.

**Proof.**We can reduce an instance $(\mathcal{C},w)$ of MINIMUM-WEIGHT SET COVER to an instance $(\overline{\mathcal{C}},\overline{w})$ of MINIMUM-WEIGHT EXACT COVER by adding the power set of each set, that is, $\overline{\mathcal{C}}:={\cup}_{{C}_{i}\in \mathcal{C}}\mathrm{P}({C}_{i})$ and $\overline{w}:=C\mapsto \mathrm{min}\underset{C\subseteq {C}_{i}}{{C}_{i}\in \mathcal{C}}w({C}_{i})$. However, applying this reduction explicitly would incur the ${2}^{|U|}|\mathcal{C}|$ term we aim to avoid. Thus, we directly calculate from $(\mathcal{C},w)$ the table Q

^{0}that would result from the input $(\overline{\mathcal{C}},\overline{w})$ in the MINIMUM-WEIGHT EXACT COVER algorithm from Lemma 3. Recall that Q

^{0}[U′] is the minimum weight of a 1-cover for U′ if such a cover exists and Q

^{0}[U′] = ∞ otherwise; here, a 1-cover is a set ${C}_{i}\in \mathcal{C}$ with U′ ⊆ C

_{i}. We can fill out Q

^{0}by first setting Q

^{0}[C

_{i}] := w(C

_{i}) for ${C}_{i}\in \mathcal{C}$ and then iterating over each set U′ ⊆ U in decreasing order of size, updating an entry Q

^{0}[U′] by

^{0}is dominated by the running time of the remaining part of the algorithm.

**Theorem 4.**Let (G, χ) be an instance of MINIMUM RAINBOW SUBGRAPH with p colors and maximum vertex degree Δ. An optimal solution can be computed in ((4Δ − 4)

^{k}+ 2

^{k}

^{Δ}

^{/}

^{2}) · n

^{O}

^{(1)}time.

**Proof.**Let (G, χ) be an instance of MINIMUM RAINBOW SUBGRAPH and let k′ be the maximum order of a connected component of a solution. Again by Lemma 1, we can perform the enumeration step in O((4Δ − 4)

^{k}

^{′}· n

^{2}) time. Then we reduce to a MINIMUM-WEIGHT SET COVER instance with U = {1, …, p}. By Lemma 4, this MINIMUM-WEIGHT SET COVER instance can be solved in 2

^{p}· n

^{O}

^{(1)}time. Since k′ ≤ k and p ≤ kΔ/2 (Equation (2)), we obtain the claimed bound. □

#### 4.3. Trees

**Theorem 5.**When the input graph is a tree, MINIMUM RAINBOW SUBGRAPH can be solved in O(2

^{p}· np

^{3}log

^{2}(np)) time.

**Proof.**We root the tree arbitrarily at a vertex r and use dynamic programming bottom-up from the leaves, utilizing fast subset convolution (Lemma 2) to get a speedup.

_{1}, …, υ

_{deg(}

_{υ}

_{)}be the children of a vertex υ ∈ V. Then T

_{j}[v, C] holds the minimum number of vertices needed to cover the colors in C using only υ and the vertices in the subtrees rooted at υ

_{1}to υ

_{j}. Further, let T

^{*}[v, C] and ${T}_{j}^{\ast}[\upsilon ,C]$ be the versions of T [v, C] and T

_{j}[v, C], respectively, where υ is required to be in the cover. Clearly, we can equate T [v, C] = T

_{deg(}

_{υ}

_{)}[v, C] and ${T}^{\ast}[\upsilon ,C]={T}_{\mathrm{deg}(\upsilon )}^{\ast}[\upsilon ,C]$.

^{*}for each leaf υ with T [v, ϕ] = 0 and T

^{*}[v, ϕ] = 1 and T [v, C] = T

^{*}[v, C] = ∞ for C ≠ ϕ. Then we use the following recurrences for each non-leaf υ and each C ⊆ {1, …, p} and 2 ≤ j ≤ deg(υ):

_{1}[υ, C] takes O(p) time per table entry; there are O(2

^{p}n) entries. Calculating ${T}_{j}^{\ast}[\upsilon ,C]$ or T

_{j}[υ, C] for all C ⊆ {1, …, p} at once can be done in O(2

^{p}· kp

^{3}log

^{2}(kp)) time using fast subset convolution with a running time as provided by Lemma 2 (note that the maximum value that we need to store in table entries is k + 1). Overall, we compute O(n) convolutions. Thus, the total running time is O(p · 2

^{p}n + 2

^{p}· kp

^{3}log

^{2}(kp) · n) = O(2

^{p}· np

^{3}log

^{2}(np)). □

## 5. Parameterization by Number of Vertex Deletions

#### 5.1. Hardness on Trees

**Instance:**An undirected graph G = (V, E) with a perfect matching M ⊆ E, and an integer κ ≥ 0.

**Question:**Is there a vertex set S ⊆ V with |S| = κ such that G[S] has no edges?

**Lemma 5.**INDEPENDENT SET WITH PERFECT MATCHING is W[1]-hard with respect to the parameter κ.

**Proof.**To show the claim, we give a parameterized reduction from the classic W[1]-hard INDEPENDENT SET problem [12] which differs from INDEPENDENT SET WITH PERFECT MATCHING only in the fact that the input graph G may not have a perfect matching.

^{∗}that contains for each vertex υ ∈ V two adjacent vertices υ

_{1}and υ

_{2}and then add for each pair of vertices u

_{i}and υ

_{j}in G

^{∗}with i, j ∈ {1, 2} the edge {u

_{i}, υ

_{j}} if u and υ are adjacent in G. If G has an independent set of size κ, then G

^{∗}has one since the subgraph G

^{∗}[{υ

_{1}| υ ∈ V}] is isomorphic to G. If G

^{∗}has an independent set S of size κ, then so does G: Since υ

_{1}and υ

_{2}are adjacent, the independent set can contain at most one of them and thus, without loss of generality it contains υ

_{1}. Hence, G

^{∗}[S] is a subgraph of G

^{∗}[{υ

_{1}| υ ∈ V}] which is isomorphic to G. Clearly, G

^{∗}has a perfect matching M consisting of the edges {υ

_{1}, υ

_{2}} for υ ∈ V. Thus, (G

^{∗}, M, κ) is an equivalent instance of INDEPENDENT SET WITH PERFECT MATCHING. The reduction runs in polynomial time and the parameter remains the same. Thus, it is a parameterized reduction. □

**Theorem 6**. RAINBOW SUBGRAPH is W[1]-hard with respect to the dual parameter ℓ even when the input is a tree of height three and every color occurs at most twice.

**Proof.**Let (G, M, κ) be an instance of INDEPENDENT SET WITH PERFECT MATCHING (which is W[1]-hard with respect to κ by Lemma 5). We construct a MINIMUM RAINBOW SUBGRAPH instance (G′ = (V′, E′), χ) as follows; an illustration is given in Figure 2. First, set V′ := V. Then do the following for each edge {u, υ} ∈ E. Add four vertices ${u}_{\upsilon}^{1}$, ${u}_{\upsilon}^{2}$, ${\upsilon}_{u}^{1}$, ${\upsilon}_{u}^{2}$. Make ${u}_{\upsilon}^{1}$ and ${u}_{\upsilon}^{2}$ adjacent and color the edge with some unique color. Analogously, make ${\upsilon}_{u}^{1}$ and ${\upsilon}_{u}^{2}$ adjacent and color the edge with some other unique color. Now, add an edge between u and ${u}_{\upsilon}^{1}$ and an edge between υ and ${\upsilon}_{u}^{1}$. Color both edges with the new color c

_{{}

_{u,v}

_{}}. Finally, add another vertex υ

^{∗}and make υ

^{∗}adjacent to all vertices of V. To color the edges between υ

^{∗}and V, we use the perfect matching M. For each edge {u, υ} of M, we color the edges {υ

^{∗}, u} and {υ

^{∗}, υ} with the same new color ${C}_{\{u,\upsilon \}}^{M}$. The resulting tree has depth three, since every leaf has distance two to a vertex from V and these vertices are all adjacent to υ

^{∗}. Moreover, every color occurs at most twice. It remains to show the following equivalence to obtain a parameterized reduction.

^{′}be a set such that |S| = κ and deleting S′ from G′ results in a rainbow graph G″. The set S has the following properties: First, υ

^{∗}is not in S, since otherwise an edge with color ${C}_{\{u,\upsilon \}}^{M}$ is missing in G″. Second, the leaves of G′ and their neighbors are also in G″, since the edges between these vertices have unique colors. Hence, S′ ⊆ V. Clearly, S′ is an independent set in G: If S′ contains two vertices u and υ that are adjacent in G, then both edges with color c

_{{}

_{u,v}

_{}}are missing from G″.□

#### 5.2. Degree and Color-Degree

_{C}:= max

_{υ∈}

_{V}|{c | ∃{u, υ} ∈ E : χ({u, υ}) = c}|, which is the maximum number of colors incident with any vertex in G. This parameter was also considered by Schiermeyer [21] for obtaining bounds on the size of minimum rainbow subgraphs. Note that the maximum color degree is upper-bounded by both the maximum degree and by the number of colors in G and that it may be much smaller than either parameter.

**Rule 1.**If there is an edge color c such that there are more than Δℓ edges with color c, then remove all edges with color c from G.

**Proof of correctness.**Deleting at most ℓ vertices from G may destroy at most Δℓ edges. Hence, any subgraph of order n − ℓ of G contains an edge of color c. Consequently, removing edges of color c from G cannot transform a no-instance into a yes-instance.

**Rule 2.**If G contains an edge {u, υ} of color c such that u and υ are obligatory, then remove all other edges with color c from G.

**Proof of correctness.**An application of the rule cannot transform a no-instance into a yes-instance, since it removes edges from G without removing the color from G. Assume that the original instance is a yes-instance. Since u and υ are obligatory, any rainbow cover contains u and υ. Therefore, any rainbow cover of the original instance contains an edge with color c and thus it is also a rainbow cover in the new instance, since only edges of color c are deleted. □

**Rule 3.**Let (G, χ) be an instance that is reduced with respect to Rule 2. Then, remove all connected components of G that consist of obligatory vertices only.

**Rule 4.**Let (G, χ) be an instance that is reduced with respect to Rule 2. If G contains three obligatory vertices u, υ, and w such that {u, υ}, {υ, w} ∈ E and u has only obligatory neighbors, then remove {u, υ} from G. If u has degree zero now, then remove u from G.

**Proof of correctness.**Let (G′ = (V′, E′), χ′) denote the instance that is produced by an application of the rule. We show that

**Rule 5.**Let (G, χ) be an instance of RAINBOW SUBGRAPH that is reduced with respect to Rule 2. If G = (V, E) contains four obligatory vertices u, υ, w, and x such that {u, υ} ∈ E and {w, x} ∈ E and u and x have only obligatory neighbors, then do the following. Remove {w, x} from G. If υ and w are not adjacent, then insert {υ, w} and assign it a unique color. If x has now degree zero, then remove x from G.

**Proof of correctness.**Let (G′ = (V′, E′), χ′) denote the instance that is produced by an application of the rule. We show that

**Lemma 6.**Let (G, χ) be an instance that is reduced with respect to Rules 1 to 5. Then, (G, χ) is a yes-instance or it contains at most 2Δ·(Δ + 1)·Δ

_{C}·ℓ

^{2}vertices.

**Proof.**We consider a special type of vertex set that can be safely deleted. To this end, call a vertex set S a colorful packing if

- no vertex in S is obligatory, and
- for all u, υ ∈ S the set of colors incident with u is disjoint from the set of colors incident with υ.

_{C}colors. For each of these colors, the graph induced by the edges of this color has at most Δℓ edges and thus at most 2Δℓ vertices, since the instance is reduced with respect to Rule 1.

_{C}· Δ · ℓ · (ℓ − 1)) · Δ since the maximum degree in G is Δ. The set Y has size at most 1 since otherwise one of the Rules 3 to 5 applies: Every vertex in Y is obligatory and has only obligatory neighbors. If two vertices of Y have a common neighbor, then Rule 4 applies. If G has a connected component consisting only of vertices of Y, then Rule 3 applies. The only remaining case is that Y has two vertices u and x that have different obligatory neighbors in X. In this case, Rule 5 applies. Since S has size at most ℓ − 1, G contains thus at most

**Theorem 7.**RAINBOW SUBGRAPH admits a problem kernel with at most 2Δ · (Δ + 1) · Δ

_{C}· ℓ

^{2}vertices that can be computed in O(m

^{2}+ mn) time.

**Proof.**The kernelization algorithm exhaustively applies Rules 1 to 5 and then checks whether the instance contains more than 2Δ · (Δ + 1) · Δ

_{C}· ℓ

^{2}vertices. If this is the case, then the algorithm answers “yes” (or reduces to a yes-instance of size one) which is correct by Lemma 6 or the instance has bounded size. It remains to show the running time of the algorithm.

^{2}+ mn). □

_{C}, ℓ) (recall that the color degree Δ

_{C}can be much smaller than Δ). First, by performing the following additional data reduction rule, we can use the kernelization result for (Δ, ℓ) to obtain a polynomial problem kernel for (Δ

_{C}, ℓ).

**Rule 6.**If G contains a vertex υ such that at least ℓ + 2 edges incident with υ have the same color c, then delete an arbitrary one of these edges.

**Proof of correctness.**Clearly, we cannot transform a no-instance into a yes-instance, since the color c remains in the graph after application of the rule. If (G, χ) is a yes-instance, then there is an order-(n − ℓ) rainbow cover of G that contains at least two vertices that are in G connected to υ by an edge with color c. Hence, removing at most one of these two edges does not destroy the rainbow cover. □

_{C}· (ℓ + 1). In combination with Theorem 7, this immediately implies the following.

**Theorem 8.**RAINBOW SUBGRAPH has a problem kernel with at most 2(Δ

_{C}+ 1)

^{3}ℓ

^{2}(ℓ + 1)

^{2}vertices that can be computed in O(m

^{2}+ mn) time.

_{C}, ℓ). Herein, deleting a vertex means to remove it from G and to decrease ℓ by one; thus, a deleted vertex is not part of a rainbow cover of order k of the original instance.

**Branching Rule 1.**If G contains a non-obligatory vertex u, then branch into the following cases. First, recursively solve the instance obtained from deleting u from G. Then, for each color c that is incident with u pick an edge {v, w} with color c. If υ (w) is non-obligatory, then recursively solve the instance obtained from deleting υ (w).

**Proof of correctness.**We show that

**Theorem 9.**RAINBOW SUBGRAPH can be solved in O((2Δ

_{C}+ 1)

^{ℓ}· (n + m)) time.

**Proof.**The algorithm exhaustively applies Branching Rule 1 until either every vertex is obligatory or ℓ ≤ 0. By the correctness of Branching Rule 1 the original instance is a yes-instance if and only if at least one of the created instances is a yes-instance.

_{C}+ 1), hence it has size O((2Δ

_{C}+ 1)

^{ℓ}). In each node of the instance, we have to test for the applicability of Branching Rule 1, which can be performed in linear time. □

## 6. Outlook

_{C}, k) of solution order and maximum color degree. From a more graph-theoretic point of view, we left open a deeper study of parameters measuring the degree of acyclicity of the underlying graph, such as treewidth or feedback set numbers. It also remains open whether there are polynomial-space fixed-parameter algorithms for the parameters (Δ, k) and (Δ, p).

## Acknowledgments

## Author Contributions

## Conflicts of Interest

## References

- Hajiaghayi, M.T.; Jain, K.; Lau, L.C.; Mandoiu, I.I.; Russell, A.; Vazirani, V.V. Minimum multicolored subgraph problem in multiplex PCR primer set selection and population haplotyping, Proceedings of the 6th International Conference on Computational Science (ICCS ’06), Reading, UK, 28–31 May 2006; Springer Berlin Heidelberg: Berlin, Germany, 2006; pp. 758–766.
- Matos Camacho, S.; Schiermeyer, I.; Tuza, Z. Approximation algorithms for the minimum rainbow subgraph problem. Discret. Math.
**2010**, 310, 2666–2670. [Google Scholar] - Fernandes, R.; Skiena, S. Microarray synthesis through multiple-use PCR primer design. Bioinformatics
**2002**, 18, 128–135. [Google Scholar] - Katrenič, J.; Schiermeyer, I. Improved approximation bounds for the minimum rainbow subgraph problem. Inf. Proc. Lett.
**2011**, 111, 110–114. [Google Scholar] - Popa, A. Better lower and upper bounds for the minimum rainbow subgraph problem. Theor. Comput. Sci.
**2014**, 543, 1–8. [Google Scholar] - Koch, M.; Matos Camacho, S.; Schiermeyer, I. Algorithmic approaches for the minimum rainbow subgraph problem. Electron. Notes Discret. Math.
**2011**, 38, 765–770. [Google Scholar] - Sharan, R.; Halldórsson, B.; Istrail, S. Islands of tractability for parsimony haplotyping. IEEE/ACM Trans. Comput. Biol. Bioinform.
**2006**, 3, 303–311. [Google Scholar] - Fleischer, R.; Guo, J.; Niedermeier, R.; Uhlmann, J.; Wang, Y.; Weller, M.; Wu, X. Extended islands of tractability for parsimony haplotyping, Proceedings of the 21st Annual Symposium on Combinatorial Pattern Matching (CPM ’10), New York, NY, USA, 21–23 June 2010; Springer Berlin Heidelberg: Berlin, Germany, 2010; pp. 214–226.
- Fellows, M.; Hartman, T.; Hermelin, D.; Landau, G.; Rosamond, F.; Rozenberg, L. Haplotype inference constrained by plausible haplotype data. IEEE/ACM Trans. Comput. Biol. Bioinform.
**2011**, 8, 1692–1699. [Google Scholar] - Hassin, R.; Segev, D. The set cover with pairs problem, Proceedings of the 25th International Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS ’05), Hyderabad, India, 15–18 December 2005; Springer Berlin Heidelberg: Berlin, Germany, 2005; pp. 164–176.
- Williamson, D.P.; Shmoys, D.B. The Design of Approximation Algorithms; Cambridge University Press: Cambridge, UK, 2011. [Google Scholar]
- Downey, R.G.; Fellows, M.R. Fundamentals of Parameterized Complexity; Springer: New York, NY, USA, 2013. [Google Scholar]
- Flum, J.; Grohe, M. Parameterized Complexity Theory; Springer Berlin Heidelberg: Berlin, Germany, 2006. [Google Scholar]
- Niedermeier, R. Invitation to Fixed-Parameter Algorithms; Oxford University Press: Oxford, UK, 2006. [Google Scholar]
- Alimonti, P.; Kann, V. Some APX-completeness results for cubic graphs. Theor. Comput. Sci.
**2000**, 237, 123–134. [Google Scholar] - Fellows, M.; Hermelin, D.; Rosamond, F.; Vialette, S. On the parameterized complexity of multiple-interval graph problems. Theor. Comput. Sci.
**2009**, 410, 53–61. [Google Scholar] - Komusiewicz, C.; Sorge, M. Finding dense subgraphs of sparse graphs, Proceedings of the 7th International Conference on Parameterized and Exact Computation (IPEC ’12), Ljubljana, Slovenia, 12–14 September 2012; Springer Berlin Heidelberg: Berlin, Germany, 2012; pp. 242–251.
- Björklund, A.; Husfeldt, T.; Koivisto, M. Set partitioning via inclusion-exclusion. SIAM J. Comput.
**2009**, 39, 546–563. [Google Scholar] - Björklund, A.; Husfeldt, T.; Kaski, P.; Koivisto, M. Fourier meets Möbius: Fast subset convolution, Proceedings of the 39th Annual ACM Symposium on Theory of Computing (STOC ’07), San Diego, CA, USA, 11–13 June 2007; ACM: New York, NY, USA, 2007; pp. 67–74.
- Fürer, M. Faster integer multiplication, Proceedings of the 39th Annual ACM Symposium on Theory of Computing (STOC ’07), San Diego, CA, USA, 11–13 June 2007; ACM: New York, NY, USA, 2007; pp. 57–66.
- Schiermeyer, I. On the minimum rainbow subgraph number of a graph. Ars Math. Contemp.
**2012**, 6, 83–88. [Google Scholar]

**Figure 1.**An edge-colored graph G with p = 4 edge colors. The subgraph G′ := G[{u, υ, w, x}] is a rainbow cover. The graph obtained from G′ by removing the red edge {u, υ} is a solution.

**Figure 2.**The reduction for showing the W[1]-hardness of RAINBOW SUBGRAPH for parameter ℓ. The graph of the INDEPENDENT SET WITH PERFECT MATCHING instance (shown on the left) has a perfect matching {{u, υ}, {w, x}}. Accordingly, the four edges from υ

^{*}to V are colored with two colors. The unique colors between the additional vertices which are not from V are shown in shades of gray.

**Table 1.**Complexity overview for RAINBOW SUBGRAPH. The O

^{∗}()-notation suppresses factors polynomial in the input size; — ” — denotes that a result follows from the entry above. Some results are inferred by parameter relations Equations (1), (2), or (3) (see Section 2).

Par. | Paths | Trees | General Graphs |
---|---|---|---|

p | O^{*}(2^{p}) (Theorem 5) | O^{*}(2^{p}) (Theorem 5) | W[1]-hard (Theorem 2) |

p, Δ | —”— | —”— | O^{*}((4Δ − 4)^{p}) (Theorem 3) |

k | O^{*} (2^{k}) (Theorem 5 + Equation (2)) | O^{*} (2^{k}) (Theorem 5 + Equation (3)) | W[1]-hard (Theorem 2 + Equation (1)) |

k, Δ | —”— | —”— | O^{*}(2^{k}^{Δ}/^{2}) (Theorem 4) |

ℓ | O^{*}(5^{ℓ}) (Theorem 9) | W[1]-hard (Theorem 6) | W[1]-hard (Theorem 6) |

ℓ, Δ | —”— | O^{*}((2Δ + 1)^{ℓ}) (Theorem 9) | O^{*}((2Δ + 1)^{ℓ}) (Theorem 9) |

O(Δ^{3}ℓ^{2})-vertex kernel (Theorem 7) | |||

ℓ, Δ_{C} | —”— | O^{*}((2Δ_{C} + 1)^{ℓ}) (Theorem 9) | O^{*}((2Δ_{C} + 1)^{ℓ}) (Theorem 9) |

$O({\mathrm{\Delta}}_{C}^{3}{\ell}^{4})$-vertex kernel (Theorem 8) | |||

ℓ, q | —”— | W[1]-hard (Theorem 6) | W[1]-hard (Theorem 6) |

q, Δ | APX-hard (Theorem 1) | APX-hard (Theorem 1) | APX-hard [4] |

© 2015 by the authors; licensee MDPI, Basel, Switzerland This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Hüffner, F.; Komusiewicz, C.; Niedermeier, R.; Rötzschke, M.
The Parameterized Complexity of the Rainbow Subgraph Problem. *Algorithms* **2015**, *8*, 60-81.
https://doi.org/10.3390/a8010060

**AMA Style**

Hüffner F, Komusiewicz C, Niedermeier R, Rötzschke M.
The Parameterized Complexity of the Rainbow Subgraph Problem. *Algorithms*. 2015; 8(1):60-81.
https://doi.org/10.3390/a8010060

**Chicago/Turabian Style**

Hüffner, Falk, Christian Komusiewicz, Rolf Niedermeier, and Martin Rötzschke.
2015. "The Parameterized Complexity of the Rainbow Subgraph Problem" *Algorithms* 8, no. 1: 60-81.
https://doi.org/10.3390/a8010060