Two-colour Zig-Zag Numberlink on rectangles

Place two pairs of terminals in distinct cells of a rectangular grid. Can two paths join the matching pairs, use only edge-adjacent moves and together visit every cell exactly once? The two-colour Zig-Zag Numberlink problem asks for a test for solvability and a way to find the paths.

Why it matters and what counts as progress

Why it matters: Covering every cell makes the choice of each path constrain the other. With one pair, the problem reduces to finding a Hamiltonian path in a rectangle. When the number of pairs is part of the input, the full-cover problem is NP-complete.

What counts as progress: Give exact solvability conditions, construct paths with a proved runtime bound or extend the result to a specified grid or terminal configuration. Keep the requirement to cover all cells and state the permitted grid shapes.

How the problem developed

  1. 1982 · One pair on a rectangle [1]

    Alon Itai, Christos Papadimitriou and Jayme Szwarcfiter Alon Itai, Christos H. Papadimitriou and Jayme Luiz Szwarcfiter characterized when a rectangular grid has a Hamiltonian path between two given cells and gave a construction.

  2. 2015 · Hardness with an unbounded number of pairs [2]

    Aaron Adcock and collaborators Aaron Adcock and collaborators proved that Zig-Zag Numberlink is NP-complete when the number of terminal pairs can grow with the grid.

  3. 19 Oct 2026 · A construction for two pairs [3]

    Z. Zzyzek with Claude Opus 5.5 Z. Zzyzek published a characterization and polynomial-time construction for two terminal pairs anywhere on a rectangle. The paper credits Claude Opus 5.5 with the mathematical work, reference implementations and Lean proof.

AI contribution

Two-Colour Zig-Zag Numberlink on Rectangles: A Forbidden-Pattern Characterization, a Constructive Polynomial-Time Algorithm, and a Lean Verification

Z. Zzyzek

Zzyzek reports a polynomial-time algorithm that decides whether two specified pairs of terminals in a rectangular grid can be joined by disjoint paths covering every cell, and constructs the paths when they exist. For rectangles with both sides at least 11, a finite list of obstructions characterizes solvability. For a shorter side at most 10, the algorithm uses frontier dynamic programming.

AI involvementAI-led
ImportanceNotable
Technical verificationFormal (Lean)
Human understandingFew
Paper date:

Sources

  1. Itai, Papadimitriou and Szwarcfiter’s rectangle path theorem
  2. Adcock and collaborators’ unbounded-pair hardness theorem
  3. Two-Colour Zig-Zag Numberlink on Rectangles: A Forbidden-Pattern Characterization, a Constructive Polynomial-Time Algorithm, and a Lean Verification
  4. Lean proof, timed algorithms and certificate checks
Publication history