Document

# ASP-Completeness of Hamiltonicity in Grid Graphs, with Applications to Loop Puzzles

## File

LIPIcs.FUN.2024.23.pdf
• Filesize: 1.01 MB
• 20 pages

## Acknowledgements

This paper was initiated during open problem solving in the MIT class on Algorithmic Lower Bounds: Fun with Hardness Proofs (6.5440) taught by Erik Demaine in Fall 2023. We thank the other participants of that class for helpful discussions and providing an inspiring atmosphere. Some figures drawn using SVG Tiler [https://github.com/edemaine/svgtiler].

## Cite As

MIT Hardness Group, Josh Brunner, Lily Chung, Erik D. Demaine, Della Hendrickson, and Andy Tockman. ASP-Completeness of Hamiltonicity in Grid Graphs, with Applications to Loop Puzzles. In 12th International Conference on Fun with Algorithms (FUN 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 291, pp. 23:1-23:20, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)
https://doi.org/10.4230/LIPIcs.FUN.2024.23

## Abstract

We prove that Hamiltonicity in maximum-degree-3 grid graphs (directed or undirected) is ASP-complete, i.e., it has a parsimonious reduction from every NP search problem (including a polynomial-time bijection between solutions). As a consequence, given k Hamiltonian cycles, it is NP-complete to find another; and counting Hamiltonian cycles is #P-complete. If we require the grid graph’s vertices to form a full m × n rectangle, then we show that Hamiltonicity remains ASP-complete if the edges are directed or if we allow removing some edges (whereas including all undirected edges is known to be easy). These results enable us to develop a stronger "T-metacell" framework for proving ASP-completeness of rectangular puzzles, which requires building just a single gadget representing a degree-3 grid-graph vertex. We apply this general theory to prove ASP-completeness of 37 pencil-and-paper puzzles where the goal is to draw a loop subject to given constraints: Slalom, Onsen-meguri, Mejilink, Detour, Tapa-Like Loop, Kouchoku, Icelom; Masyu, Yajilin, Nagareru, Castle Wall, Moon or Sun, Country Road, Geradeweg, Maxi Loop, Mid-loop, Balance Loop, Simple Loop, Haisu, Reflect Link, Linesweeper; Vertex/Touch Slitherlink, Dotchi-Loop, Ovotovata, Building Walk, Rail Pool, Disorderly Loop, Ant Mill, Koburin, Mukkonn Enn, Rassi Silai, (Crossing) Ichimaga, Tapa, Canal View, and Aqre. The last 13 of these puzzles were not even known to be NP-hard. Along the way, we prove ASP-completeness of some simple forms of Tree-Residue Vertex-Breaking (TRVB), including planar multigraphs with degree-6 breakable vertices, or with degree-4 breakable and degree-1 unbreakable vertices.

## Subject Classification

##### ACM Subject Classification
• Theory of computation → Problems, reductions and completeness
##### Keywords
• pencil-and-paper puzzles
• computational complexity
• parsimony

## Metrics

• Access Statistics
• Total Accesses (updated on a weekly basis)
0

## References

1. Zachary Abel, Jeffrey Bosboom, Michael Coulombe, Erik D. Demaine, Linus Hamilton, Adam Hesterberg, Justin Kopinsky, Jayson Lynch, Mikhail Rudoy, and Clemens Thielen. Who witnesses The Witness? Finding witnesses in The Witness is hard and sometimes impossible. Theoretical Computer Science, 839:41-102, November 2020.
2. Takanori Akiyama, Takao Nishizeki, and Nobuji Saito. NP-completeness of the Hamiltonian cycle problem for bipartite graphs. Journal of Information Processing, 3(2):73-76, 1980. URL: https://ipsj.ixsq.nii.ac.jp/ej/?action=repository_action_common_download&item_id=59994&item_no=1&attribute_id=1&file_no=1.
3. Daniel Andersson. Hashiwokakero is NP-complete. Information Processing Letters, 109(19):1145-1146, 2009. URL: https://doi.org/10.1016/j.ipl.2009.07.017.
4. Esther M. Arkin, Michael A. Bender, Erik D. Demaine, Sándor P. Fekete, Joseph S. B. Mitchell, and Saurabh Sethia. Optimal covering tours with turn costs. SIAM Journal on Computing, 35(3):531-566, 2005.
5. Esther M. Arkin, Sándor P. Fekete, and Joseph S.B. Mitc hell. Approximation algorithms for lawn mowing and milling. Computational Geometry: Theory and Applications, 17(1-2):25-50, 2000. URL: https://doi.org/10.1016/S0925-7721(00)00015-8.
6. Esther M. Arkin, Sándor P. Fekete, Kamrul Islam, Henk Meijer, Joseph S. B. Mitchell, Yurai Núñez-Rodríguez, Valentin Polishchuk, David Rappaport, and Henry Xiao. Not being (super)thin or solid is hard: A study of grid hamiltonicity. Computational Geometry: Theory and Applications, 42(6-7):582-605, 2009. URL: https://doi.org/10.1016/j.comgeo.2008.11.004.
7. Samuel W. Bent and Udi Manber. On non-intersecting Eulerian circuits. Discrete Applied Mathematics, 18(1):87-94, 1987. URL: https://doi.org/10.1016/0166-218X(87)90045-X.
8. Jeffrey Bosboom, Charlotte Chen, Lily Chung, Spencer Compton, Michael Coulombe, Erik D. Demaine, Martin L. Demaine, Ivan Tadeu Ferreira Antunes Filho, Dylan Hendrickson, Adam Hesterberg, Calvin Hsu, William Hu, Oliver Korten, Zhezheng Luo, and Lillian Zhang. Edge matching with inequalities, triangles, unknown shape, and two players. Journal of Information Processing, 28:987-1007, 2020.
9. Erik D. Demaine, Joshua Lockhart, and Jayson Lynch. The computational complexity of Portal and other 3D video games. In Proceedings of the 9th International Conference on Fun with Algorithms (FUN 2018), pages 19:1-19:22, La Maddalena, Italy, June 2018.
10. Erik D. Demaine and Mikhail Rudoy. Hamiltonicity is hard in thin or polygonal grid graphs, but easy in thin polygonal grid graphs. arXiv:1706.10046, 2017. URL: https://arXiv.org/abs/1706.10046.
11. Erik D. Demaine and Mikhail Rudoy. Tree-Residue Vertex-Breaking: a new tool for proving hardness. In Proceedings of the 20th Scandinavian Symposium and Workshops on Algorithm Theory (SWAT 2018), pages 32:1-32:14, Malmö, Sweden, June 2018. Full paper at URL: https://arXiv.org/abs/1706.07900.
12. Tomás Feder and Carlos Subi. On Barnette’s conjecture. Electronic Colloquium on Computational Complexity (ECCC), January 2006.
13. Michal Forišek. Computational complexity of two-dimensional platform games. In Proceedings of the 5th International Conference on Fun with Algorithms, pages 214-227, Ischia, Italy, June 2010. URL: https://doi.org/10.1007/978-3-642-13122-6_22.
14. Erich Friedman. Pearl puzzles are NP-complete. Manuscript, August 2002. URL: https://erich-friedman.github.io/papers/pearl.pdf.
15. M. R. Garey, D. S. Johnson, and L. Stockmeyer. Some simplified NP-complete problems. In Proceedings of the 6th Annual ACM Symposium on Theory of Computing, pages 47-63, Seattle, Washington, 1974. URL: https://doi.org/10.1145/800119.803884.
16. M. R. Garey, D. S. Johnson, and R. Endre Tarjan. The planar Hamiltonian circuit problem is NP-complete. SIAM Journal on Computing, 5(4):704-714, 1976. URL: https://doi.org/10.1137/0205049.
17. Kaiying Hou and Jayson Lynch. The computational complexity of finding Hamiltonian cycles in grid graphs of semiregular tessellations. In Stephane Durocher and Shahin Kamali, editors, Proceedings of the 30th Canadian Conference on Computational Geometry (CCCG 2018), pages 114-128, Winnipeg, Canada, August 2018. URL: http://www.cs.umanitoba.ca/~cccg2018/papers/session3B-p1.pdf.
18. Ayaka Ishibashi, Yuichi Sato, and Shigeki Iwata. NP-completeness of two pencil puzzles: Yajilin and Country Road. Utilitas Mathematica, 88, June 2012. URL: https://utilitasmathematica.com/index.php/Index/article/view/863.
19. Alon Itai, Christos H. Papadimitriou, and Jayme Luiz Szwarcfiter. Hamilton paths in grid graphs. SIAM Journal on Computing, 11(4):676-686, 1982. URL: https://doi.org/10.1137/0211056.
20. Chuzo Iwamoto and Tatsuya Ide. Moon-or-Sun, Nagareru, and Nurimeizu are NP-complete. IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences, 105(9):1187-1194, 2022.
21. Shohei Kanehiro and Yasuhiko Takenaga. Satogaeri, Hebi, and Suraromu are NP-complete. In Proceedings of the 3rd International Conference on Applied Computing and Information Technology/2nd International Conference on Computational Science and Intelligence, pages 46-51, 2015.
22. Richard M. Karp. Reducibility among combinatorial problems. In Proceedings of a Symposium on the Complexity of Computer Computations, pages 85-103, Yorktown Heights, New York, March 1972. URL: https://doi.org/10.1007/978-1-4684-2001-2_9.
23. Daisuke Kobayashi, Robert Vollmert, Lennard Sprong, et al. puzz.link. URL: https://puzz.link.
24. M. S. Krishnamoorthy. An NP-hard problem in bipartite graphs. SIGACT News, 7(1):26, January 1975. URL: https://doi.org/10.1145/990518.990521.
25. Maciej Liśkiewicz, Mitsunori Ogihara, and Seinosuke Toda. The complexity of counting self-avoiding walks in subgraphs of two-dimensional grids and hypercubes. Theoretical Computer Science, 304(1):129-156, 2003. URL: https://doi.org/10.1016/S0304-3975(03)00080-X.
26. Mieke Maarse. The NP-completeness of some lesser known logic puzzles. Bachelor’s thesis, Utrecht University, June 2019. URL: https://studenttheses.uu.nl/handle/20.500.12932/33867.
27. Christos H. Papadimitriou. On the complexity of the parity argument and other inefficient proofs of existence. Journal of Computer and System Sciences, 48(3):498-532, 1994. URL: https://doi.org/10.1016/S0022-0000(05)80063-7.
28. Christos H. Papadimitriou and Umesh V. Vazirani. On two geometric problems related to the travelling salesman problem. Journal of Algorithms, 5(2):231-246, 1984. URL: https://doi.org/10.1016/0196-6774(84)90029-4.
29. Ján Plesník. The NP-completeness of the Hamiltonian cycle problem in planar diag raphs with degree bound two. Information Processing Letters, 8(4):199-201, April 1979. URL: https://doi.org/10.1016/0020-0190(79)90023-1.
30. Takahiro Seta. The complexities of puzzles, Cross Sum, and their Another Solution Problems (ASP). Senior thesis, University of Tokyo, 2002. URL: https://web.archive.org/web/20221007013910/www-imai.is.s.u-tokyo.ac.jp/~seta/paper/senior_thesis/seniorthesis.pdf.
31. Hadyn Tang. On the NP-completeness of satisfying certain path and loop puzzles. arXiv:2004.12849, 2020. URL: https://arXiv.org/abs/2004.12849.
32. Hadyn Tang. A framework for loop and path puzzle satisfiability NP-hardness results. arXiv:2202.02046, 2022. URL: https://arXiv.org/abs/2202.02046.
33. Mu-Tsun Tsai and Douglas B. West. A new proof of 3-colorability of Eulerian triangulations. Ars Mathematica Contempornanea, 4(1):73-77, 2011. URL: https://doi.org/10.26493/1855-3974.193.8E7.
34. W. T. Tutte. On Hamiltonian circuits. Journal of the London Mathematical Society, Series 1, 21(2):98-101, 1946. URL: https://doi.org/10.1112/jlms/s1-21.2.98.
35. Akihiro Uejima, Hiroaki Suzuki, and Atsuki Okada. The complexity of generalized pipe link puzzles. Journal of Information Processing, 25:724-729, 2017.
36. Takayuki Yato. On the NP-completeness of the Slither Link puzzle. IPSJ SiG Notes, AL-74:25-32, 2000.
37. Takayuki Yato and Takahiro Seta. Complexity and completeness of finding another solution and its application to puzzles. IEICE Transactions on Fundamentals of Electronics, Communications, and Computer Sciences, E86-A(5):1052-1060, 2003. Also IPSJ SIG Notes 2002-AL-87-2, 2002. URL: http://ci.nii.ac.jp/naid/110003221178/en/.
X

Feedback for Dagstuhl Publishing