Search papers, labs, and topics across Lattice.
The paper introduces cayleyR, an R package designed to solve the TopSpin(n,k) puzzle by leveraging cycle intersections in Cayley graphs. By employing an iterative bidirectional search approach, the algorithm generates random operation sequences from both the initial and target states to find connecting paths through cycle intersections. The implementation integrates a C++ hash-indexed state store and optional Vulkan GPU acceleration, enhancing performance and accessibility for researchers and enthusiasts alike.
Cycle intersections in Cayley graphs can efficiently solve the TopSpin puzzle, revealing new pathways in permutation puzzle research.
We present cayleyR, an R package for solving permutation puzzles by detecting cycle intersections in Cayley graphs. The core algorithm performs an iterative bidirectional search: from both the initial and target permutation states, random operation sequences generate cycles in the Cayley graph of the symmetric group Sn; their intersection yields a connecting path. When no direct intersection is found, a distance-guided bridge selection narrows the gap, and the process repeats. The package targets the TopSpin(n,k) puzzle, whose state space is a Cayley graph of Sn generated by a cyclic shift and a prefix reversal. We describe the mathematical framework, the algorithm, and its implementation, which combines a C++ hash-indexed state store with optional Vulkan GPU acceleration. The software is publicly available on CRAN.