How Bad is the Freedom to Flood-It?

04/23/2018 ∙ by Rémy Belmonte, et al. ∙ University of Electro-Communications Université Paris-Dauphine 0

Fixed-Flood-It and Free-Flood-It are combinatorial problems on graphs that generalize a very popular puzzle called Flood-It. Both problems consist of recoloring moves whose goal is to produce a monochromatic ("flooded") graph as quickly as possible. Their difference is that in Free-Flood-It the player has the additional freedom of choosing the vertex to play in each move. In this paper, we investigate how this freedom affects the complexity of the problem. It turns out that the freedom is bad in some sense. We show that some cases trivially solvable for Fixed-Flood-It become intractable for Free-Flood-It. We also show that some tractable cases for Fixed-Flood-It are still tractable for Free-Flood-It but need considerably more involved arguments. We finally present some combinatorial properties connecting or separating the two problems. In particular, we show that the length of an optimal solution for Fixed-Flood-It is always at most twice that of Free-Flood-It, and this is tight.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Flood-It is a popular puzzle, originally released as a computer game in 2006 by LabPixies (see [2]). In this game, the player is presented with (what can be thought of as) a vertex-colored grid graph, with a designated special pivot vertex, usually the top-left corner of the grid. In each move, the player has the right to change the color of all vertices contained in the same monochromatic component as the pivot to a different color of her choosing. Doing this judiciously gradually increases the size of the pivot’s monochromatic component, until the whole graph is flooded with one color. The goal is to achieve this flooding with the minimum number of moves. See Figure 1 for an example.

Figure 1: A flooding sequence on a grid. Each move in this example changes the color of the top-left monochromatic component. Under such a restriction, the depicted sequence is shortest.

Following the description above, Flood-It immediately gives rise to a natural optimization problem: given a vertex-colored graph, determine the shortest sequence of flooding moves that wins the game. This problem has been extensively studied in the last few years (e.g. [13, 16, 18, 17, 10, 6, 21, 7, 19, 12]; a more detailed summary of known results is given below), both because of the game’s popularity (and addictiveness!), but also because the computational complexity questions associated with this problem have turned out to be surprisingly deep, and the problem has turned out to be surprisingly intractable.

The goal of this paper is to add to our understanding of this interesting, puzzle-inspired, optimization problem, by taking a closer look at the importance of the pivot vertex. As explained above, the classical version of the game only allows the player to change the color of a special vertex and its component and has been studied under the name Fixed-Flood-It [16, 18, 17] (or Flood-It in some papers [2, 21, 6, 7, 12]). However, it is extremely natural to also consider a version where the player is also allowed to play a different vertex of her choosing in each turn. This has also been well-studied under the name Free-Flood-It [2, 13, 16, 18, 17, 6, 21]. See Figure 2.

Figure 2: A flooding sequence with no restriction on selected monochromatic components. This is shorter than then one in Figure 1.

Since both versions of this problem have been studied before, the question of the impact of the pivot vertex on the problem’s structure has (at least implicitly) been considered. Intuitively, one would expect Free-Flood-It to be a harder problem; after all, the player has to choose a color to play and a vertex to play it on, and is hence presented with a larger set of possible moves. The state of the art seems to confirm this intuition, as only some of the positive algorithmic results known for Fixed-Flood-It are known also for Free-Flood-It, while there do exist some isolated cases where Fixed-Flood-It is tractable and Free-Flood-It is hard, for example co-comparability graphs [8, 10] and grids of height [2, 17]. Nevertheless, these results do not completely pinpoint the added complexity brought by the task of selecting a vertex to play, as the mentioned algorithms for Fixed-Flood-It are already non-trivial, and hence the jump in complexity is likely to be the result of the combination of the tasks of picking a color and a vertex. More broadly, [6] presented a generic reduction from Fixed-Flood-It to Free-Flood-It that preserves a number of crucial parameters (number of colors, optimal value, etc.) and gives convincing evidence that Free-Flood-It is always at least as hard as Fixed-Flood-It, but not necessarily harder.

Our Results

We investigate the complexity of Free-Flood-It, mostly from the point of view of parameterized complexity,111For readers unfamiliar with the basic notions of this field, we refer to standard textbooks [4, 9]. as well as the impact on the combinatorics of the game of allowing moves outside the pivot.

Our first result is to show that Free-Flood-It is W[2]-hard parameterized by the number of moves in an optimal solution. We recall that for Fixed-Flood-It this parameterization is trivially fixed-parameter tractable: when a player has only moves available, then we can safely assume that the graph uses at most (roughly) colors, hence one can easily consider all possible solutions in FPT time. The interest of our result is, therefore, to demonstrate that the task of deciding which vertex to play next is sufficient to make Free-Flood-It significantly harder than Fixed-Flood-It. Indeed, the W[2]-hardness reduction we give, implies also that Free-Flood-It is not solvable in time under the ETH. This tightly matches the complexity of a trivial algorithm which considers all possible vertices and colors to be played. This is the first concrete example showing a case where Fixed-Flood-It is essentially trivial, but Free-Flood-It is intractable.

Motivated by this negative result we consider several other parameterizations of the problem. We show that Free-Flood-It is fixed-parameter tractable when parameterized by the number of possible moves and the clique-width. This result is tight in the sense that the problem is hard when parameterized by only one of these parameters. It also implies the fixed-parameter tractability of the problem parameterized by the number of colors and the modular-width. In a similar vein, we present a polynomial kernel when Free-Flood-It is parameterized by the input graph’s neighborhood diversity and number of colors. An analogous result was shown for Fixed-Flood-It in [7], but because of the freedom to select vertices, several of the tricks used there do not apply to Free-Flood-It, and our proofs are slightly more involved. Our previously mentioned reduction also implies that Free-Flood-It does not admit a polynomial kernel parameterized by vertex cover, under standard assumptions. This result was also shown for Fixed-Flood-It in [7], but it does not follow immediately for Free-Flood-It, as the reduction of [6] does not preserve the graph’s vertex cover.

Motivated by the above results, which indicate that the complexity of the problem can be seriously affected if one allows non-pivot moves, we also study some more purely combinatorial questions with algorithmic applications. The main question we pose here is the following. It is obvious that for all instances the optimal number of moves for Free-Flood-It is upper-bounded by the optimal number of moves for Fixed-Flood-It (since the player has strictly more choices), and it is not hard to construct instances where Fixed-Flood-It needs strictly more moves. Can we bound the optimal number of Fixed-Flood-It moves needed as a function of the optimal number of Fixed-Flood-It moves? Somewhat surprisingly, this extremely natural question does not seem to have been explicitly considered in the literature before. Here, we completely resolve it by showing that the two optimal values cannot be more than a factor of apart, and constructing a family of simple instances where they are exactly a factor of apart. As an immediate application, this gives a -approximation for Free-Flood-It for every case where Fixed-Flood-It is known to be tractable.

We also consider the problem’s monotonicity: Fixed-Flood-It has the nice property that even an adversary that selects a single bad move cannot increase the optimal (that is, in the worst case a bad move is a wasted move). We construct minimal examples which show that Free-Flood-It does not have this nice monotonicity property, even for extremely simple graphs, that is, making a bad move may not only waste a move but also make the instance strictly worse. Such a difference was not explicitly stated in the literature, while the monotonicity of Fixed-Flood-It was seem to be known or at least assumed. The only result we are aware of is the monotonicity of Free-Flood-It on paths shown by Meeks and Scott [16].

Known results

In 2009, the NP-hardness of Fixed-Flood-It with six colors was sketched by Elad Verbin as a comment to a blog post by Sariel Har-Peled [23]. Independently to the blog comment, Clifford et al. [2] and Fleischer and Woeginger [8] started investigations of the complexity of the problem, and published the conference versions of their papers at FUN 2010. Here we mostly summarize some of the known results on Free-Flood-It. For more complete lists of previous result, see e.g. [10, 13, 7].

Free-Flood-It is NP-hard if the number of colors is at least 3 [2] even for trees with only one vertex of degree more than 2 [13, 6], while it is polynomial-time solvable for general graphs if the number of colors is at most 2 [2, 16, 13]. Moreover, it is NP-hard even for height-3 grids with four colors [16]. Note that this result implies that Free-Flood-It with a constant number colors is NP-hard even for graphs of bounded bandwidth. If the number of colors is unbounded, then it is NP-hard for height-2 grids [17], trees of radius 2 [6], and, proper interval graphs and caterpillars [10]. Also, it is known that there is no constant-factor approximation with a factor independent of the number of colors unless  [2].

There are a few positive results on Free-Flood-It. Meeks and Scott [18] showed that every colored graph has a spanning tree with the same coloring such that the minimum number of moves coincides in the graph and the spanning tree. Using this property, they showed that if a graph has only a polynomial number of vertex subsets that induce connected subgraphs, then Free-Flood-It (and Fixed-Flood-It) on the graph can be solved in polynomial time. This in particular implies the polynomial-time solvability on subdivisions of a fixed graph. It is also known that Free-Flood-It for interval graphs and split graphs is fixed-parameter tractable when parameterized by the number of colors [10].

2 Preliminaries

For a positive integer , we use to denote the set . Given a graph , a coloring function , where is a positive integer, and , we denote by the maximal set of vertices such that for all , and there exists a path from to such that for all its internal vertices we have . In other words, is the monochromatic connected component that contains under the coloring function .

Given , a move is defined as a pair where , . The result of the move is a new coloring function defined as follows: for all ; for all other vertices. In words, a move consists of changing the color of , and of all vertices in the same monochromatic component as , to . Given the above definition we can also define the result of a sequence of moves on a colored graph with initial coloring function in the natural way, that is, for each , is the result of move on .

The Free-Flood-It problem is defined as follows: given a graph , an integer , and an initial coloring function , decide if there exists a sequence of moves such that the result obtained by applying this sequence of moves on is a constant function (that is, we have ).

In the Fixed-Flood-It problem we are given the same input as in the Free-Flood-It problem, as well as a designated vertex (the pivot). The question is again if there exists a sequence of moves such that is monochromatic, with the added constraint that we must have for all .

We denote by the minimum such that for the input (or respectively) the Free-Flood-It problem (respectively the Fixed-Flood-It problem) admits a solution.

2.1 Graph parameters

Vertex cover number: A set is a vertex cover of a graph if each edge in has at least one end point in . The minimum size of a vertex cover of a graph is its vertex cover number. By , we denote the vertex cover number of .

Neighborhood diversity: Let be a graph. For each vertex , we denote the neighborhood of by . The closed neighborhood of is the set . We omit the subscript when the underlying graph is clear from the context. Two vertices are true twins in if and are false twins in if . Two vertices are twins if they are true twins or false twins. Note that true twins are adjacent and false twins are not. The neighborhood diversity of , denoted , is the minimum number such that can be partitioned into sets of twin vertices. It is known that for every graph  [14]. Given a graph, its neighborhood diversity and the corresponding partition into sets of twins can be computed in polynomial time [14]; in fact, using fast modular decomposition algorithms, the neighborhood diversity of a graph can be computed in linear time [15, 22].

Modular-width: Let be a graph with vertices , and let be graphs. The substitution of the vertices of by is the graph with the vertex set and the edge set . For each , the set is called a module of . The modular-width of , denoted , is defined recursively as follows:

  • If has only one vertex, then .

  • If is the disjoint union of graphs , then .

  • If is a connected graph with two or more vertices, then

    where the minimum is taken over all tuples of graphs such that .

A recursive substitution structure giving the modular-width can be computed in linear-time [15, 22]. It is known that for every graph  [11].

Clique-width: A -expression is a rooted binary tree such that

  • each leaf has label for some ,

  • each non-leaf node with two children has label , and

  • each non-leaf node with only one child has label or (, ).

Each node in a -expression represents a vertex-labeled graph as follows:

  • a -node represents a graph with one -vertex;

  • a -node represents the disjoint union of the labeled graphs represented by its children;

  • a -node represents the labeled graph obtained from the one represented by its child by replacing the labels of the -vertices with ;

  • an -node represents the labeled graph obtained from the one represented by its child by adding all possible edges between the -vertices and the -vertices.

A -expression represents the graph represented by its root. The clique-width of a graph , denoted by , is the minimum integer such that there is a -expression representing a graph isomorphic to . From their definitions, holds for every graph .

Figure 3 shows relationships among the graph parameters introduced above together with the well-known treewidth and pathwidth (see [4] for definitions of these two parameters).

Figure 3: Graph parameters. Each segment implies that the one above is more general than the one below. For example, bounded modular-width implies bounded clique-width but not vice versa.

3 W[2]-hardness of Free-Flood-It

The main result of this section is that Free-Flood-It is W[2]-hard when parameterized by the minimum length of any valid solution (the natural parameter). The proof consists of a reduction from Set Cover, a canonical W[2]-complete problem.

Before presenting the construction, we recall two basic observations by Meeks and Vu [19], both of which rest on the fact that any single move can (at most) eliminate a single color from the graph, and this can only happen if a color induces a single component.


For any graph , and coloring function that uses distinct colors, we have .


For any graph , and coloring function that uses distinct colors, such that for all , is a disconnected graph, we have .

The proof of Theorem 3 relies on a reduction from a special form of Set Cover, which we call Multi-Colored Set Cover (MCSC for short). MCSC is defined as follows:

In Multi-Colored Set Cover (MCSC) we are given as input a set of elements and collections of subsets of , . We are asked if there exist sets such that for all , , and .

Observe that MCSC is just a version of Set Cover where the collection of sets is given to us pre-partitioned into parts and we are asked to select one set from each part to form a set cover of the universe. It is not hard to see that any Set Cover instance where we are asked if there exists a set cover of size can easily be transformed to an equivalent MCSC instance simply by setting for all , since the definition of MCSC does not require that the sub-collections be disjoint. We conclude that known hardness results for Set Cover immediately transfer to MCSC, and in particular MCSC is W[2]-hard when parameterized by .


We are now ready to describe our reduction which, given a MCSC instance with universe and collections of sets , produces an equivalent instance of Free-Flood-It, that is, a graph and a coloring function on . We construct this graph as follows:

  • for every set , construct a vertex in . The set of vertices in corresponding to sets of is denoted by and for each . induces an independent set colored .

  • for each , construct new vertices, denoted by and connect all of them to all vertices of such that induces a complete bipartite graph of size . Then set for each , for all .

  • for each vertex for , construct new leaf vertices connected to with distinct colors .

  • for each element , construct a vertex . For each such that we connect to the vertex of that represents .

  • add a special vertex with which is connected it to all vertices in for .

An illustration of is shown in Fig.4. In the following we will show that as an instance of Free-Flood-It is solvable with at most moves if and only if the given MCSC instance has a set cover of size which contains one set of each .

Figure 4: The graph of Free-Flood-It constructed from the given MCSC instance. All the vertices in each have color and all black vertices have color . Boxes containing black vertices have size . Also each vertex in has neighbors with degree 1 colored .

If is a YES instance of MCSC then .


Suppose that there is a solution of the given MCSC instance, with , for and . Recall that for each there is a vertex in in the constructed graph representing . Our first moves consist of changing the color of each of these vertices to in some arbitrary order.

Observe that in the graph resulting after these moves the vertices with color form a single connected component: because is a set cover, all vertices of have a neighbor with color ; all vertices with color in some are in the same component as ; and all vertices of are connected to one of the vertices we played. Furthermore, observe that this component dominates the graph: all remaining vertices of , as well as all leaves attached to vertices of are dominated by the vertices of . Hence, we can select an arbitrary vertex with color , say , and cycle through the colors on this vertex to make the graph monochromatic. ∎

Now we establish the converse of Lemma 3.

If , then is a YES instance of MCSC.


Suppose that there exists a sequence of at most moves solving . We can assume without loss of generality that the sequence has length exactly , since performing a move on a monochromatic graph keeps the graph monochromatic. Let be a solution, let , and let denote the coloring of obtained after the first moves. The key observation that we will rely on is the following:

For all , there exist such that .

In other words, we claim that for each group there exists a vertex that received color at some point during the first moves. Before proceeding, let us prove this claim. Suppose for contradiction that the claim is false. Then, there exists a group such that no vertex in that group has color in any of the colorings . We now consider the vertices of and their attached leaves. Since contains vertices, there exist two vertices of such that contains neither , nor any of their attached leaves. In other words, there exist two vertices of on which the winning sequence does not change colors by playing them or their private neighborhood directly. However, since only have neighbors in (except for their attached leaves), and no vertex of received color , we conclude that , that is, the colors of these two vertices have remained unchanged, and the same is true for their attached leaves. Consider now the graph with coloring : we observe that this coloring uses distinct colors, and that each color induces a disconnected graph. This is true for colors because of the leaves attached to , and true of color because of and the fact that no vertex of has color . We conclude that by Lemma 3, which is a contradiction, because the whole sequence has length .

Because of claim (i) we can now conclude that for all there exists a such that . In other words, for each color there exists a move among the first moves of the solution that played a vertex which at that point had color . To see that this is true consider again for contradiction the case that for some this statement does not hold: this implies that vertices with color in still have color in , which means that no vertex of has received color in the first moves, contradicting (i).

As a result of the above, we therefore claim that for all , we have . In other words, we claim that none of the first moves changes the color of a vertex that at that point had color . This is because, as argued, for each of the other colors, there is a move among the first moves that changes a vertex of that color. We therefore conclude that for all vertices for which we have for all . In addition, because in all colors induce independent sets, each of the first moves changes the color of a single vertex. Because of claim (i), this means that for each one of the first moves changes the color of a single vertex from to . We select the corresponding set of in our MCSC solution.

We now observe that, since all vertices of retain color throughout the first moves, is a coloring function that uses distinct colors, and colors induce disconnected graphs (because of the leaves attached to the vertices of each ). Thanks to Lemma 3, this means that must induce a connected graph. Hence, all vertices of have a neighbor with color in , which must be one of the vertices played in the first moves; hence the corresponding element is dominated by our solution and we have a valid set cover selecting one set from each . ∎

We are now ready to combine Lemmas 3 and 3 to obtain the main result of this section.

Free-Flood-It is W[2]-hard parameterized by , that is, parameterized by the length of the optimal solution. Furthermore, if there is an algorithm that decides if a Free-Flood-It instance has a solution of length in time , then the ETH is false.


The described construction, as well as Lemmas 3 and 3 give a reduction from MCSC, which is W[2]-hard parameterized by , to an instance of Free-Flood-It with colors, where the question is to decide if . Furthermore, it is known that MCSC generalizes Dominating Set, which does not admit an algorithm running in time , under the ETH [4]. Since our reduction only modifies by a constant, we odtain the same result for Free-Flood-It. ∎

We note that because of Lemma 3 we can always assume that the number of colors of a given instance is not much higher than the length of the optimal solution. As a result, Free-Flood-It parameterized by is equivalent to the parameterization of Free-Flood-It by and the result of Theorem 3 also applies to this parameterization.

3.1 Kernel lower bound for Free-Flood-It

As a byproduct of the reduction above, we can show a kernel lower bound for Free-Flood-It parameterized by the vertex cover number.

Let and be parameterized problems. A polynomial-time computable function is a polynomial parameter transformation from to if there is a polynomial such that for all ,

  • if and only if , and

  • .

If such a function exits, then is polynomial parameter reducible to .

Proposition ([1]).

Let and be parameterized problems, and and be unparameterized versions of and , respectively. Suppose is NP-hard, is in NP, and is polynomial parameter reducible to . If has a polynomial kernel, then also has a polynomial kernel.

Free-Flood-It parameterized by the vertex cover number admits no polynomial kernel unless .


The reduction in this section can be seen as a polynomial parameter transformation from MCSC parameterized by the solution size and the size of the universe to Free-Flood-It parameterized by the vertex cover number with a polynomial . To see this observe that the black vertices in Figure 4 form a vertex cover of size .

Since MCSC is NP-hard and the decision version of Free-Flood-It is in NP, Proposition 3.1 implies that if Free-Flood-It parameterized by the vertex cover number has a polynomial kernel, then MCSC parameterized by and also has a polynomial kernel.

It is known that Set Cover (and thus MCSC) parameterized simultaneously by and does not admit a polynomial kernel unless  [5]. This completes the proof. ∎

4 Clique-width and the number of moves

In this section, we consider as a combined parameter for Free-Flood-It the length of an optimal solution and the clique-width. We show that this case is indeed fixed-parameter tractable by using the theory of the monadic second-order logic on graphs. As an application of this result, we also show that combined parameterization by the number of colors and the modular-width is fixed-parameter tractable.

To prove the main claim, we show that Free-Flood-It with a constant length of optimal solutions is an MSO-definable decision problem. The syntax of MSO (one-sorted monadic second-order logic) of graphs includes (i) the logical connectives , , , , , (ii) variables for vertices and vertex sets, (iii) the quantifiers and applicable to these variables, and (iv) the following binary relations:

  • for a vertex variable and a vertex set variable ;

  • for two vertex variables and , where the interpretation is that and are adjacent;

  • equality of variables.

If models an MSO formula with an assignment to the free variables in , then we write .

It is known that, given a graph of clique-width at most , an MSO formula , and an assignment to the free variables in , the problem of deciding whether models with the given assignment is solvable in time , where is a computable function and is the length of  [3, 20].

Given an instance of Free-Flood-It such that has vertices and clique-width at most , it can be decided in time whether , where is some computable function.


Let () be the set of color vertices in the input graph. We construct an MSO formula with free variables such that if and only if models with the assignment for . We can define the desired formula as follows:

where for implies that the color of is after the moves .

We define recursively as follows. We first set . This is correct as we assign to . For , we set

where implies that and are in the same monochromatic component after the moves . The formula precisely represent the recursive nature of the color of the vertices. That is, a vertex is of color after the th move if and only if either its color is changed to by the move, or it was already of color before the th move and its color is not changed by the move.

Given that is defined for all and , defining is a routine:

Since by Lemma 3, it holds that is bounded by a function of . ∎

Given an integer and an instance of Free-Flood-It such that has vertices and modular-width at most , it can be decided in time whether , where is some computable function.


Observe that for every connected graph of modular-width at most , it holds that : we pick one vertex from a module ; we next color one vertex in each module except with ; we then play at with the remaining colors. Thus we can assume that . Since the modular-width of a graph is at most its clique-width by their definitions, Theorem 4 gives an -time algorithm for some computable , which can be seen as an -time algorithm for some computable . ∎

5 Neighborhood diversity and the number of colors

Since the modular-width of a graph is upper bounded by its neighborhood diversity, Corollary 4 in the previous section implies that Free-Flood-It is fixed-parameter tractable when parameterized by both the neighborhood diversity and the number of colors. Here we show that Free-Flood-It admits a polynomial kernel with the same parameterization. This section is devoted to a proof of the following theorem. Free-Flood-It admits a kernel of at most vertices.

Fellows et al. [7] observed that for Fixed-Flood-It, a polynomial kernel with the same parameterization can be easily obtained since twin vertices of the same color can be safely contracted. In Free-Flood-It, this is true for true twins but not for false twins. See Figure 5.

(a) Removing a false twin is not safe.
(b) Removing a twin color is not safe.
Figure 5: Simple reductions that do not work for Free-Flood-It.

Though it might be still possible to show something like “if there are more than some constant number of false twins with the same color, then one can remove one of them without changing the minimum number of moves,” here we show a weaker claim. Our reduction rules are as follows:

  • Rule TT: Let and be true twins of the same color in . Remove .

  • Rule FT: Let be a set of false-twin vertices of the same color in such that . Remove arbitrary one vertex in .

Observe that after applying TT and FT exhaustively in polynomial time, the obtained graph can have at most vertices. This is because each set of twin vertices can contain at most vertices. Hence, to prove Theorem 5, it suffices to show the safeness of the rules.

Rule TT is safe.


Let and be true twins of the same color. Observe that removing is equivalent to contracting the edge . Since and are in the same monochromatic component, the lemma holds. ∎

To guarantees the safeness of FT, we need the following technical lemmas. Let be an instance of Free-Flood-It and be false-twin vertices of the same color . A sequence with for is a valid flooding sequence for if and only if it is a valid flooding sequence for .


Let . If a neighbor of and has color , then the lemma trivially holds. Hence, in what follows, we assume that none of the vertices adjacent to and has color . Assume that is valid for at least one of and . Then there is a move that changes the color of a neighbor of to since for . Let be the first such move.

The first part of the sequence has the same effect to and . That is, the monochromatic components and connection among them are the same in and except that contains the monochromatic component . Note that is a monochromatic component of color in both and , and and have the same adjacent monochromatic components in .

Let be the set of monochromatic components of color in that are adjacent to . Similarly, let be the set of monochromatic components of color in that are adjacent to . Observe that , , and .

Now we apply the move . It follows that and . Since and both and include , the components and have the same adjacent monochromatic components. Also, for each , holds.

This implies that and are equivalent and thus the remaining of the sequence, i.e. , has the same effect to and . Therefore, is constant if and only if so is . ∎

Let be a set of false-twin vertices with the same color in . If , then for every .


We first show that for every . Let be an optimal valid flooding sequence for . Assume that (otherwise we are done). Since , there is a vertex such that for . By Lemma 5, is valid for as well.

Next we show the other direction. Since is a set of monochromatic false-twin vertices, it suffices to show that for some . Let be an optimal valid flooding sequence of . Since , there are two vertices such that for . By Lemma 5, is valid for as well. ∎

Rule FT is safe.


Let be a connected graph and a coloring of with colors. Observe that admits a flooding sequence of length as follows. Let be a maximal set of twin vertices of and be a color used in . For each maximal set of twin vertices of , pick a vertex and play the move . After these moves, the vertices of color form a connected dominating set of . Now pick a vertex of color and play the move for each . These moves make the coloring constant.

Now for some color class and a false-twin class of , if , then we can remove an arbitrary vertex in while preserving the optimal number of steps by Lemma 5. This implies the safeness of FT. ∎

Note that using the concept of twin colors, Fellows et al. [7] further reduced the number of colors in instances of Fixed-Flood-It and obtained a (nonpolynomial-size) kernel parameterized by the neighborhood diversity. They say that two colors are twin if the colors appear in the same family of the maximal sets of twin vertices. They observed that, in Fixed-Flood-It, removing one of twin colors reduced the fewest number of moves exactly by 1. Unfortunately, this is not the case for Free-Flood-It. See Figure 5.

6 Relation Between Fixed and Free Flood-It

The main theorem of this section is the following:

For any graph , coloring function on , and we have

Theorem 6 states that the optimal solutions for Free-Flood-It and Fixed-Flood-It can never be more than a factor of apart. It is worthy of note that we could not hope to obtain a constant smaller than in such a theorem, and hence the theorem is tight.

There exist instances of Fixed-Flood-It such that


Consider a path on vertices properly colored with colors . If we set the pivot to be one of the endpoints then . However, it is not hard to obtain a Free-Flood-It solution with

moves by playing every vertex at odd distance from the pivot. ∎

Before we proceed to give the proof of Theorem 6, let us give a high-level description of our proof strategy and some general intuition. The first inequality is of course trivial, so we focus on the second part. We will establish it by induction on the number of non-pivot moves performed by an optimal Free-Flood-It solution. The main inductive argument is based on observing that a valid Free-Flood-It solution will either at some point play a neighbor of the component of to give it the same color as , or if not, it will at some point play to give it the same color as one of its neighbors. The latter case is intuitively easier to handle, since then we argue that the move that changed ’s color can be performed first, and if the first move is a pivot move we can easily fall back on the inductive hypothesis. The former case, which is the more interesting one, can be handled by replacing the single move that gives the same color as , with two moves: one that gives the same color as , and one that flips back to its previous color. Intuitively, this basic step is the reason we obtain a factor of in the relationship between the two versions of the game.

The inductive strategy described above faces some complications due to the fact that rearranging moves in this way may unintentionally re-color some vertices, which makes it harder to continue the rest of the solution as before. To avoid this we define a somewhat generalized version of Free-Flood-It, called Subset-Free-Flood-It.

Given , a coloring function on , and a pivot , a set-move is a pair , with and for some , or . The result of is the coloring that sets for ; and otherwise.

We define Subset-Free-Flood-It as the problem of determining the minimum number of set-moves required to make a graph monochromatic, and Subset-Fixed-Flood-It as the same problem when we impose the restriction that every move must change the color of , and denote as the corresponding optimum values.

Informally, a set-move is the same as a normal move in Free-Flood-It, except that we are also allowed to select an arbitrary connected monochromatic set that contains (even if is not maximal) and change its color. Intuitively, one would expect moves that set to be a proper subset of to be counter-productive, since such moves split a monochromatic component into two pieces. Indeed, we prove below in Lemma 6 that the optimal solutions to Fixed-Flood-It and Subset-Fixed-Flood-It coincide, and hence such moves do not help. The reason we define this version of the game is that it gives us more freedom to define a solution that avoids unintentionally recoloring vertices as we transform a given Free-Flood-It solution to a Fixed-Flood-It solution.

For any graph , coloring function on , and pivot we have .


First, observe that is trivial, as any solution of Fixed-Flood-It is a solution to Subset-Fixed-Flood-It by playing the same sequence of colors and always selecting all of the connected monochromatic component of .

Let us also establish the converse inequality. Consider a solution of Subset-Fixed-Flood-It, where by definition we have for all . We would like to prove that is a valid solution for Fixed-Flood-It. Let be the result of the first set-moves of the former solution, and be the result of the first moves of the latter solution. We will establish by induction the following:

  1. For all we have .

  2. For all we have .

The statements are true for . Suppose that the two statements are true after moves. The first solution now performs the set-move with