CayleyR: Solving the TopSpin puzzle via cycle intersection
Quick Answer
This paper shows that The cayleyR R package efficiently solves the TopSpin(n,k) puzzle using cycle intersections in Cayley graphs.
Quick Take
The cayleyR R package efficiently solves the TopSpin(n,k) puzzle using cycle intersections in Cayley graphs. It employs a bidirectional search algorithm that generates cycles from both initial and target states, optimizing the search with distance-guided bridge selection and optional GPU acceleration. The software is publicly available on CRAN.
Key Points
- cayleyR targets the TopSpin(n,k) permutation puzzle using Cayley graphs.
- The algorithm combines bidirectional search with cycle intersection detection.
- Distance-guided bridge selection improves search efficiency when direct intersections are absent.
- The package integrates a C++ hash-indexed state store for performance.
- Publicly available on CRAN for researchers and developers.
Paper Resources
📖 Reader Mode
~2 min readAbstract: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.
| Comments: | 17 pages, 2 figures |
| Subjects: | Artificial Intelligence (cs.AI) |
| MSC classes: | 20B40, 05C25, 68W05 |
| ACM classes: | F.2.2; I.2.8; G.2.1 |
| Cite as: | arXiv:2607.13219 [cs.AI] |
| (or arXiv:2607.13219v1 [cs.AI] for this version) | |
| https://doi.org/10.48550/arXiv.2607.13219 arXiv-issued DOI via DataCite (pending registration) |
Submission history
From: Yuri Baramykov [view email]
[v1]
Tue, 14 Jul 2026 19:28:41 UTC (312 KB)
— Originally published at arxiv.org
Want this in your inbox every morning?
Daily brief at your local 8am — bilingual EN/中文, free.
More from arXiv cs.AI
See more →Automatic Ordinary Differential Equations Discovery For Biological Systems Using Large Language Model Powered Agentic System
The MEDA system utilizes large language models and symbolic regression to autonomously discover ordinary differential equations for biological systems, achieving strong structural recovery and biologically plausible models. It outperforms existing methods by integrating domain knowledge and mechanistic constraints, demonstrating effective retrieval and extrapolation capabilities.


