Colored Token Routing
- Colored token routing is defined as the problem of swapping tokens on graph vertices to achieve a prescribed color configuration.
- It exhibits sharp complexity dichotomies, being NP-complete for 3-colors on constrained graphs and PSPACE-complete under specific swap constraints.
- Applications span sorting networks, quantum circuit compilation, and blockchain token attribution, employing both sequential and parallel swap models.
Colored token routing encompasses a family of combinatorial reconfiguration problems in which tokens, each bearing a color label, must be routed or swapped across the vertices of a graph so that the final arrangement matches a prescribed coloring pattern. Tokens of the same color are considered indistinguishable, and only colored configurations, not token identities, matter. Both sequential (one swap per step) and parallel (multiple swaps via edge matchings per step) models are studied. Colored token routing is motivated by problems in sorting networks, quantum circuit compilation, molecule assembly, and onchain token attribution. The underlying computational questions pose rich complexity-theoretic, algorithmic, and parameterized challenges, tied closely to the structure of the graph, color set, and allowable swap constraints.
1. Formal Definition and Problem Variants
The fundamental model comprises:
- An undirected graph .
- A set of token-colors.
- A mapping (initial token placement).
- A target coloring , with , .
A legal move swaps tokens on adjacent vertices . The goal is to find a minimal-length sequence of such swaps that transforms into so that for all , the color at equals . The decision version asks, for a given budget , whether such a sequence exists of length at most : $\mathrm{TokenSwapping}_{\mathrm{col}}(G, \tau_0, \tau^*, k)\ :\ \text{Is there a sequence of at most %%%%14%%%% swaps converting %%%%15%%%% into %%%%16%%%%?}$ Extensions include subset token swapping (where a token can have multiple valid destinations) and constrained colored token swapping (where swaps are only allowed between specific pairs of colors, described by a swap-constraint graph ) (Bonnet et al., 2016, Bilò et al., 14 Jan 2026, Yamanaka et al., 2018).
Parallel (or matching-based) variants allow, in each round, a set of pairwise-disjoint edges (a matching) to carry out all swaps simultaneously. Given initial and target colorings , the objective is to minimize the number of parallel swap rounds to reach (Kawahara et al., 2016, Bansal et al., 2024).
2. Computational Complexity and Parameterized Results
Colored token routing problems exhibit sharp complexity dichotomies depending on the number of colors, the type of allowed swaps, and the structure of the underlying and swap-constraint graphs.
- NP-completeness: The problem is NP-complete for even when is planar, bipartite, and of degree at most 3 (Bonnet et al., 2016, Yamanaka et al., 2018, Kawahara et al., 2016). For parallel (matching) swaps, 3-colored routing is NP-complete for steps, and 2-colored routing becomes NP-hard for (Kawahara et al., 2016).
- PSPACE-completeness: The constrained variant CCTS is PSPACE-hard for colors when the swap-constraint graph is a path ; membership in PSPACE holds via explicit configuration graph simulation (Bilò et al., 14 Jan 2026).
- Fixed-Parameter Tractability (FPT) and XP:
- If parameterized by (the number of swaps), colored token swapping is -hard; no -time algorithm exists unless ETH fails (Bonnet et al., 2016).
- In nowhere-dense graph classes (including all planar and bounded treewidth graphs), CTS (and even the more general subset token swapping) is FPT in (Bonnet et al., 2016).
- With parameter (maximum degree), the problem admits an FPT algorithm with a kernel size bounded by (Bonnet et al., 2016).
- For degree-2 graphs (disjoint paths/cycles), -time XP algorithms exist parameterized by (Yamanaka et al., 2018).
- On the complete graph, CTS is FPT parameterized by color count , using a cycle cover reduction to integer linear programming (Yamanaka et al., 2018).
3. Algorithmic Frontiers and Special Graph Classes
The tractability border for colored token routing is highly sensitive to the structure of and the allowed color-interaction graph . The landscape, for both sequential and parallel routing, is summarized as follows (Bonnet et al., 2016, Yamanaka et al., 2018, Kawahara et al., 2016, Bilò et al., 14 Jan 2026):
| Graph Class | Unconstrained CTS | With Swap Constraints H |
|---|---|---|
| Path | Poly-time (greedy) | Star H: poly-time; Path H: hard |
| Star | Poly-time | Star H: poly-time |
| Clique | NP-complete | |
| Tree (c=2) | Linear-time | Star H: poly-time |
| Tree (c≥3) | Open | |
| Planar/cubic | NP-complete (c≥3) | PSPACE-complete for , (Bilò et al., 14 Jan 2026) |
| Complete graph | FPT in c |
For , the problem is poly-time solvable on general graphs via a minimum-weight perfect matching approach. Paths and stars admit efficient sorting strategies. For parallel routing, the decision problem is tractable for , , but hard for , or , (Kawahara et al., 2016).
Constrained CTS becomes tractable if and only if the swap-constraint graph is -free (i.e., a clique or a star), and is PSPACE-complete otherwise (Bilò et al., 14 Jan 2026). In the star case, the problem reduces to canonical pebble motion, leveraging classical results on the 15-puzzle parity criterion.
4. Approximation Algorithms and Quantum Circuit Applications
In parallel colored token routing, constant-factor approximation algorithms have been established for structured graphs prevalent in qubit-mapping for quantum hardware, such as grids, cycles, and subdivided stars (Bansal et al., 2024):
- On cycles, coloring reduces to selecting cyclic shifts; a greedy odd–even strategy achieves makespan at most twice the lower bound for even cycles ().
- On subdivided stars, a multi-phase methodology yields complexity at most , where is the branch count.
- For grid graphs, a three-phase row/column/row approach ensures .
These results guarantee that, for quantum circuit routing, swap depth can be kept within a constant factor of an instance-specific lower bound (maximum token–target distance), providing near-optimality in scheduling SWAP gates for indistinguishable qubits (Bansal et al., 2024).
The stretch factor, defined as the maximal ratio over all instances of the algorithmic makespan to the distance lower bound, is constant for lines (2), linear in for cycles, and for grids.
5. Color Constraints, Swap Models, and Token Fungibility
The structure and constraints of the color-interaction graph (which pairs of colors are allowed to swap when their tokens are on endpoints of an edge) create the most significant impact on both decision and optimization complexity.
- If is a star—one color swappable with all others, no others allowed—CTS reduces to pebble motion, with a complete polynomial-time characterization using generalized transitivity and permutation parity (Bilò et al., 14 Jan 2026).
- If induces a path , the problem simulates nondeterministic constraint logic—showing universality and PSPACE-completeness (Bilò et al., 14 Jan 2026).
- When tokens of the same color are entirely fungible and the only constraint is eventual matching of multiset colorings at each vertex, the system underpins practical algorithms for fungible token attribution in distributed ledgers (Zarick et al., 2023). In such models, colored balances are maintained per wallet, and "color routing" involves constrained burns, mints, and cross-domain invariants for consistency and traceability, distinct from graph-reconfiguration models.
6. Open Problems and Future Directions
Key open questions concern the complexity of colored token swapping on various families for small (e.g., trees), the existence of constant-approximation algorithms for arbitrary graphs in colored routing via parallel swaps, and the parameterized complexity for novel parameter sets (e.g., total tokens moved, number of color classes occupied). Another direction is the systematic study of stretch-factor tightness on graph classes beyond those with known constant-factor strategies (Bansal et al., 2024), and the exploration of real-world, large-scale colored routing protocols in high-throughput blockchain and distributed ledger contexts (Zarick et al., 2023).
The theoretical landscape is now sharply characterized: for unconstrained or star-constrained swaps, colored token routing is in P or FPT (with explicit parametrizations). As soon as swap limitations encode a path of length four in the interaction graph, PSPACE-hardness emerges, even on highly restricted base graphs (Bilò et al., 14 Jan 2026). This threshold dictates the tractability frontier for both theoretical study and practical algorithm implementation.