2-FREE-FLOOD-IT is polynomial
We study a discrete diffusion process introduced in some combinatorial games called FLOODIT and MADVIRUS that can be played online and whose computational complexity has been recently studied by Arthu
We study a discrete diffusion process introduced in some combinatorial games called FLOODIT and MADVIRUS that can be played online and whose computational complexity has been recently studied by Arthur et al (FUN'2010). The flooding dynamics used in those games can be defined for any colored graph. It has been shown in a first report (in french, hal-00509488 on HAL archive) that studying this dynamics directly on general graph is a valuable approach to understand its specificities and extract uncluttered key patterns or algorithms that can be applied with success to particular cases like the square grid of FLOODIT or the hexagonal grid of MADVIRUS, and many other classes of graphs. This report is the translation from french to english of the section in the french report showing that the variant of the problem called 2-FREE-FLOOD-IT can be solved with a polynomial algorithm, answering a question raised in the previous study of FLOODIT by Arthur et al.
💡 Research Summary
The paper addresses the computational complexity of a restricted version of the well‑known Flood‑It puzzle, called 2‑FREE‑FLOOD‑IT. In the general Flood‑It problem, a player repeatedly selects a colour and “floods” the region containing the starting cell, merging it with all adjacent cells of the chosen colour. The goal is to turn the entire board into a single colour using as few moves as possible. While the unrestricted version is known to be NP‑hard, the authors investigate the case where only two colours are allowed and the flood operation can be applied to any component (the “free” variant).
The main contribution is a polynomial‑time algorithm that computes the optimal number of moves for any graph coloured with exactly two colours. The authors first transform the input coloured graph into a colour‑component tree: each maximal monochromatic connected component becomes a node, and edges connect components that are adjacent in the original graph. Because only two colours are present, this component graph is bipartite and, crucially, contains no cycles—it is a tree (or a forest that can be rooted arbitrarily).
With this tree representation, the flooding process corresponds to repeatedly merging a node with all its neighbours of the opposite colour. The authors show that the optimal sequence of merges can be obtained by a dynamic‑programming (DP) traversal of the tree. For each node v, they define f(v) as the minimum number of moves required to flood the entire subtree rooted at v when v is the last colour to dominate that subtree. The DP recurrence is simple: leaf nodes have f(v)=0; for an internal node, f(v)=1+max_{child c} f(c) (or an equivalent formulation that aggregates the children’s costs). The algorithm performs a depth‑first search to compute f(v) for all nodes, and the value at the chosen root yields the global optimum.
The time complexity consists of two linear‑time phases: building the component tree (O(|V|+|E|)) and the DP pass (O(|V|)). The overall running time is therefore O(n log n) in the worst case, but in practice it behaves linearly, and the memory consumption is O(n).
To prove optimality, the authors use a contradiction argument. Suppose a sequence of moves uses fewer steps than the DP solution. Because only two colours exist, any move that does not merge all currently reachable components of the selected colour would be wasteful; such a move would create a “redundant colour switch” that can be eliminated without increasing the move count. By systematically removing these redundancies, any purportedly better sequence can be transformed into one that follows the DP‑derived order, contradicting the assumption of superiority. Hence the DP algorithm indeed yields the minimum possible number of moves.
The paper also discusses why this approach does not extend to three or more colours. With three colours, the component graph may contain cycles, breaking the tree structure that underlies the DP recurrence. Consequently, the problem reverts to NP‑hardness, aligning with earlier results by Arthur et al. (FUN’2010).
In summary, the authors resolve an open question from prior work by demonstrating that 2‑FREE‑FLOOD‑IT is solvable in polynomial time. Their method isolates the essential combinatorial structure of the two‑colour case, provides a clear and efficient algorithm, and clarifies the boundary between tractable and intractable variants of Flood‑It. This contribution not only settles the complexity of the specific variant but also offers insight that may guide the design of approximation algorithms for the more general, multi‑colour versions.
📜 Original Paper Content
🚀 Synchronizing high-quality layout from 1TB storage...