Introduction

Flow Free has been installed hundreds of millions of times. The premise is gentle: a grid holds a few pairs of colored dots, and you drag a pipe from each dot to its twin. Two rules only — pipes may never cross, and together they must cover every single cell.

It feels like doodling. You trace a path, it blocks another, you back up and try again. But underneath, each puzzle is a precise question: is there any way to route all the colors at once so that nothing crosses and no cell is left empty?

That puzzle has a real name in mathematics — Numberlink — and the innocent question "can it be solved?" turns out to be one of the hardest kinds of question we know how to ask.

Connect the Pairs

Here is a small board with a few colored endpoints. Click an empty cell to extend the currently selected color's path from its last cell; build a path from each dot to its matching dot. The goal: no crossings and every cell filled.

<p class="hint">{{hint}}</p>
<div class="palette" id="palette"></div>
<div id="board" class="board"></div>
<div class="status" id="status">{{pick_color}}</div>
<div class="btns">
  <button id="check" type="button">{{check_board}}</button>
  <button id="solve" type="button">{{solve}}</button>
  <button id="reset" type="button" class="ghost">{{clear}}</button>
</div>
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; }
.hint { font-size: .9rem; color: #444; margin: 0 0 .7rem; line-height: 1.45; }
.palette { display: flex; gap: .4rem; margin: 0 0 .5rem; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent;
          cursor: pointer; }
.swatch.sel { border-color: #1d3557; }
.board { display: grid; grid-template-columns: repeat(5, 46px); gap: 4px; margin: .4rem 0; }
.cell { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
        border-radius: 8px; user-select: none; background: #eef1f4; border: 1px solid #d7dde3;
        cursor: pointer; transition: background .1s; position: relative; }
.cell:hover { background: #e3e8ed; }
.cell .dot { width: 30px; height: 30px; border-radius: 50%; }
.cell.path { border-radius: 4px; }
.status { font-size: 1rem; font-weight: 600; margin: .5rem 0; min-height: 1.4em; }
.status.ok { color: #0a7d33; }
.status.bad { color: #c92f3c; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; }
button { font: 600 14px system-ui, sans-serif; padding: .45rem .9rem; border: 1px solid #1d3557;
         background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
// Code not found

Notice the asymmetry. Checking a finished board is effortless: trace each color and confirm the paths connect, never overlap, and cover everything. Finding such a routing is the hard part — press Solve and the computer searches the tree of possible moves. Each empty cell multiplies the branches, and the count explodes long before the grid looks big.

The Real Complexity

How hard is Flow Free, really? Not the dragging — the deciding.

  • Checking a finished board is trivial: confirm each color forms one connected path, no two paths share a cell, and every cell is used.
  • Brute force tries every way to grow the paths through the empty cells — the number of routings grows exponentially, hopeless on anything past a small grid.
  • It's NP-complete. The underlying puzzle is known in mathematics as Numberlink. Researchers proved that deciding whether a board has a valid solution is NP-complete — including the cover-every-cell variant that Flow Free uses (Adcock, Demaine, Demaine et al., and independently Kotsuma & Takenaga). The puzzle's wires and turns can be arranged to encode any SAT formula.
  • So deciding even is-this-board-solvable is equivalent to the whole NP-complete family — no known method beats trying combinations in the worst case.

That is the punchline: the moment a board can't be settled by quick local reasoning, you are staring at a genuine instance of the same problem behind P vs NP. The backtracking Flow Free makes you do by hand is intractability made playable.

Where It Matters

"Connect these pairs with non-crossing paths through a limited space" is exactly the shape of some very real engineering problems, and Flow Free is its friendly face:

  • Chip and circuit-board wiring: laying out wires that connect terminals without crossing, in the tight space of a VLSI chip or a PCB, is a disjoint-paths routing problem — the same core puzzle.
  • Network path planning: assigning non-overlapping routes to many connections across a shared fabric is the same kind of constraint.
  • Disjoint-paths problems: the abstract version, finding vertex-disjoint paths between given pairs in a graph, is a classic question in algorithms and combinatorial optimization.
  • Teaching complexity: because the rules fit on one screen, Flow Free is a vivid on-ramp to what NP-completeness means.

Learn why Flow Free is hard and you've met disjoint-path routing — the same difficulty that haunts SAT and graph problems like Hamiltonian paths.

Conclusion

Flow Free hides a beautiful secret: the same pipes that calm you down are the Numberlink puzzle, and deciding whether a board can be solved at all is NP-complete. Checking a finished routing stays instant; finding one is as hard as anything in computer science.

So the next time a level forces you to rip up half the board and start over, take comfort — you aren't bad at it. You've simply run into P vs NP wearing a coat of bright pipes, and there may be no clever shortcut around the search at all.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/flow-free/Content licensed under CC BY-NC 4.0.