Papers
Topics
Authors
Recent
Search
2000 character limit reached

Colored Token Routing

Updated 17 February 2026
  • 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 G=(V,E)G = (V, E).
  • A set CC of token-colors.
  • A mapping τ0:VC\tau_0: V \to C (initial token placement).
  • A target coloring τ:VC\tau^*: V \to C, with cC\forall c \in C, {v:τ0(v)=c}={v:τ(v)=c}|\{v: \tau_0(v) = c\}| = |\{v: \tau^*(v) = c\}|.

A legal move swaps tokens on adjacent vertices {u,v}E\{u, v\} \in E. The goal is to find a minimal-length sequence of such swaps that transforms τ0\tau_0 into τ\tau^* so that for all vv, the color at vv equals τ(v)\tau^*(v). The decision version asks, for a given budget kk, whether such a sequence exists of length at most kk: $\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 H=(C,EH)H=(C, E_H)) (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 MEM \subset E of pairwise-disjoint edges (a matching) to carry out all swaps simultaneously. Given initial and target colorings f,g:V{1,...,c}f, g: V \to \{1, ..., c\}, the objective is to minimize the number of parallel swap rounds to reach gg (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 c=3c=3 even when GG 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 p=2p=2 steps, and 2-colored routing becomes NP-hard for p3p \ge 3 (Kawahara et al., 2016).
  • PSPACE-completeness: The constrained variant CCTS is PSPACE-hard for k=4k=4 colors when the swap-constraint graph HH is a path P4P_4; membership in PSPACE holds via explicit configuration graph simulation (Bilò et al., 14 Jan 2026).
  • Fixed-Parameter Tractability (FPT) and XP:
    • If parameterized by kk (the number of swaps), colored token swapping is W[1]W[1]-hard; no f(k)no(k/logk)f(k) n^{o(k / \log k)}-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 kk (Bonnet et al., 2016).
    • With parameter k+Δk + \Delta (maximum degree), the problem admits an FPT algorithm with a kernel size bounded by 2k+2k2Δk2k + 2k^2 \Delta^k (Bonnet et al., 2016).
    • For degree-2 graphs (disjoint paths/cycles), O(nc+2)O(n^{c+2})-time XP algorithms exist parameterized by cc (Yamanaka et al., 2018).
    • On the complete graph, CTS is FPT parameterized by color count cc, 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 GG and the allowed color-interaction graph HH. 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 k=4k=4, H=P4H=P_4 (Bilò et al., 14 Jan 2026)
Complete graph FPT in c

For c=2c=2, 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 c=2c=2, p2p\le2, but hard for c3c\ge3, p2p\ge2 or c=2c=2, p3p\ge3 (Kawahara et al., 2016).

Constrained CTS becomes tractable if and only if the swap-constraint graph HH is P4P_4-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 (A(G,C)2OPTA(G,C) \le 2\,\mathrm{OPT}).
  • On subdivided stars, a multi-phase methodology yields complexity at most 4OPT+min{OPT,h}+14\,\mathrm{OPT} + \min\{\mathrm{OPT}, h\} + 1, where hh is the branch count.
  • For h×nh \times n grid graphs, a three-phase row/column/row approach ensures A(G,C,L)2OPT+2hA(G,C,\mathcal{L}) \le 2\,\mathrm{OPT} + 2h.

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 nn for cycles, and O(h)O(h) for grids.

5. Color Constraints, Swap Models, and Token Fungibility

The structure and constraints of the color-interaction graph HH (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 HH 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 HH induces a path P4P_4, 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 c3c \ge 3 (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.

Topic to Video (Beta)

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Colored Token Routing.