Structural and Combinatorial Properties of 2-swap Word Permutation Graphs
Duncan Adamson, Nathan Flaherty, Igor Potapov, Paul G. Spirakis
TL;DR
This work studies the configuration graph $G(P)$ whose vertices are all words with a fixed Parikh vector $P$ and edges correspond to a single 2-swap operation. It proves an exact diameter $D = n - \max_{i \in \Sigma} P[i]$, characterizes the clique structure with $\\omega(G(P)) = \max_i P[i] + 1$, and establishes that $G(P)$ admits a Hamiltonian path starting at every vertex. The authors provide constructive enumeration algorithms that generate a Hamiltonian path via swaps, offering $O(n \log n)$ preprocessing and $O(\log n)$ delay for binary alphabets (and $O(\\sigma \log n)$ for general alphabets). These results contribute to the theory of combinatorial Gray codes on multiset permutations and have implications for efficient space exploration and enumeration tasks in related domains. The work also lays groundwork for extensions to $k$-swap variants and connections to combinatorial structures such as CSP and necklaces.
Abstract
In this paper, we study the graph induced by the $\textit{2-swap}$ permutation on words with a fixed Parikh vector. A $2$-swap is defined as a pair of positions $s = (i, j)$ where the word $w$ induced by the swap $s$ on $v$ is $v[1] v[2] \dots v[i - 1] v[j] v[i+1] \dots v[j - 1] v[i] v[j + 1] \dots v[n]$. With these permutations, we define the $\textit{Configuration Graph}$, $G(P)$ defined over a given Parikh vector. Each vertex in $G(P)$ corresponds to a unique word with the Parikh vector $P$, with an edge between any pair of words $v$ and $w$ if there exists a swap $s$ such that $v \circ s = w$. We provide several key combinatorial properties of this graph, including the exact diameter of this graph, the clique number of the graph, and the relationships between subgraphs within this graph. Additionally, we show that for every vertex in the graph, there exists a Hamiltonian path starting at this vertex. Finally, we provide an algorithm enumerating these paths from a given input word of length $n$ with a delay of at most $O(\log n)$ between outputting edges, requiring $O(n \log n)$ preprocessing.
