An Asymptotically Fast Polynomial Space Algorithm for Hamiltonicity Detection in Sparse Directed Graphs

Author Andreas Björklund

Thumbnail PDF


  • Filesize: 0.68 MB
  • 12 pages

Document Identifiers

Author Details

Andreas Björklund
  • Private, Lund, Sweden - This work was done while being employed by Ericsson Research


We are very grateful to an anonymous reviewer who pointed out a serious flaw in an earlier proof attempt of Lemma 6. We also thank Łukasz Kowalik for comments on an earlier version of the paper.

Cite AsGet BibTex

Andreas Björklund. An Asymptotically Fast Polynomial Space Algorithm for Hamiltonicity Detection in Sparse Directed Graphs. In 38th International Symposium on Theoretical Aspects of Computer Science (STACS 2021). Leibniz International Proceedings in Informatics (LIPIcs), Volume 187, pp. 15:1-15:12, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2021)


We present a polynomial space Monte Carlo algorithm that given a directed graph on n vertices and average outdegree δ, detects if the graph has a Hamiltonian cycle in 2^{n-Ω(n/δ)} time. This asymptotic scaling of the savings in the running time matches the fastest known exponential space algorithm by Björklund and Williams ICALP 2019. By comparison, the previously best polynomial space algorithm by Kowalik and Majewski IPEC 2020 guarantees a 2^{n-Ω(n/(2^δ))} time bound. Our algorithm combines for the first time the idea of obtaining a fingerprint of the presence of a Hamiltonian cycle through an inclusion-exclusion summation over the Laplacian of the graph from Björklund, Kaski, and Koutis ICALP 2017, with the idea of sieving for the non-zero terms in an inclusion-exclusion summation by listing solutions to systems of linear equations over ℤ₂ from Björklund and Husfeldt FOCS 2013.

Subject Classification

ACM Subject Classification
  • Theory of computation → Parameterized complexity and exact algorithms
  • Hamiltonian cycle
  • directed graph
  • worst case analysis algorithm


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


  1. Alexander I. Barvinok. Two algorithmic results for the traveling salesman problem. Math. Oper. Res., 21(1):65-84, 1996. URL:
  2. Eric T. Bax. Inclusion and exclusion algorithm for the Hamiltonian path problem. Inf. Process. Lett., 47(4):203-207, 1993. Google Scholar
  3. Richard Bellman. Dynamic programming treatment of the travelling salesman problem. J. ACM, 9(1):61-63, January 1962. URL:
  4. Andreas Björklund. Determinant sums for undirected Hamiltonicity. SIAM J. Comput., 43(1):280-299, 2014. Google Scholar
  5. Andreas Björklund. Exploiting sparsity for bipartite Hamiltonicity. In Wen-Lian Hsu, Der-Tsai Lee, and Chung-Shou Liao, editors, 29th International Symposium on Algorithms and Computation, ISAAC 2018, December 16-19, 2018, Jiaoxi, Yilan, Taiwan, volume 123 of LIPIcs, pages 3:1-3:11. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018. URL:
  6. Andreas Björklund, Holger Dell, and Thore Husfeldt. The parity of set systems under random restrictions with applications to exponential time problems. In Magnús M. Halldórsson, Kazuo Iwama, Naoki Kobayashi, and Bettina Speckmann, editors, Automata, Languages, and Programming - 42nd International Colloquium, ICALP 2015, Kyoto, Japan, July 6-10, 2015, Proceedings, Part I, volume 9134 of Lecture Notes in Computer Science, pages 231-242. Springer, 2015. URL:
  7. Andreas Björklund and Thore Husfeldt. The parity of directed Hamiltonian cycles. In 54th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2013, 26-29 October, 2013, Berkeley, CA, USA, pages 727-735, 2013. Google Scholar
  8. Andreas Björklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto. The traveling salesman problem in bounded degree graphs. ACM Trans. Algorithms, 8(2):18:1-18:13, 2012. URL:
  9. Andreas Björklund, Petteri Kaski, and Ioannis Koutis. Directed Hamiltonicity and out-branchings via generalized Laplacians. In Ioannis Chatzigiannakis, Piotr Indyk, Fabian Kuhn, and Anca Muscholl, editors, 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, volume 80 of LIPIcs, pages 91:1-91:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2017. URL:
  10. Andreas Björklund, Petteri Kaski, and Ryan Williams. Generalized Kakeya sets for polynomial evaluation and faster computation of fermionants. Algorithmica, 81(10):4010-4028, 2019. URL:
  11. Andreas Björklund and Ryan Williams. Computing permanents and counting Hamiltonian cycles by listing dissimilar vectors. In Christel Baier, Ioannis Chatzigiannakis, Paola Flocchini, and Stefano Leonardi, editors, 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, July 9-12, 2019, Patras, Greece, volume 132 of LIPIcs, pages 25:1-25:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. URL:
  12. Marek Cygan, Stefan Kratsch, and Jesper Nederlof. Fast Hamiltonicity checking via bases of perfect matchings. J. ACM, 65(3):12:1-12:46, 2018. URL:
  13. Michael Held and Richard M. Karp. A dynamic programming approach to sequencing problems. Journal for the Society for Industrial and Applied Mathematics, pages 1-10, 1962. Google Scholar
  14. Erich Kaltofen. On computing determinants of matrices without divisions. In Paul S. Wang, editor, Proceedings of the 1992 International Symposium on Symbolic and Algebraic Computation, ISSAC '92, Berkeley, CA, USA, July 27-29, 1992, pages 342-349. ACM, 1992. Google Scholar
  15. Richard M. Karp. Reducibility among combinatorial problems. In Raymond E. Miller and James W. Thatcher, editors, Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York, USA, The IBM Research Symposia Series, pages 85-103. Plenum Press, New York, 1972. URL:
  16. Richard M. Karp. Dynamic programming meets the principle of inclusion and exclusion. Operations Research Letters, 1(2):49-51, 1982. Google Scholar
  17. Samuel Kohn, Allan Gottlieb, and Meryle Kohn. A generating function approach to the traveling salesman problem. In Proceedings of the 1977 Annual Conference, ACM '77, page 294–300. Association for Computing Machinery, 1977. Google Scholar
  18. Łukasz Kowalik and Konrad Majewski. The asymmetric travelling salesman problem in sparse digraphs. In 15th International Symposium on Parameterized and Exact Computation (IPEC 2020), volume 180 of Leibniz International Proceedings in Informatics (LIPIcs), pages 23:1-23:18, Dagstuhl, Germany, 2020. Schloss Dagstuhl - Leibniz-Zentrum für Informatik. URL:
  19. Ketan Mulmuley, Umesh V. Vazirani, and Vijay V. Vazirani. Matching is as easy as matrix inversion. Combinatorica, 7(1):105-113, 1987. URL:
  20. W. T. Tutte. The dissection of equilateral triangles into equilateral triangles. Mathematical Proceedings of the Cambridge Philosophical Society, 44(4):463-482, 1948. Google Scholar
  21. Ryan Williams. A new algorithm for optimal constraint satisfaction and its implications. In Josep Díaz, Juhani Karhumäki, Arto Lepistö, and Donald Sannella, editors, Automata, Languages and Programming: 31st International Colloquium, ICALP 2004, Turku, Finland, July 12-16, 2004. Proceedings, volume 3142 of Lecture Notes in Computer Science, pages 1227-1237. Springer, 2004. URL: