Document Open Access Logo

Counting Homomorphisms Modulo a Prime Number

Authors Amirhossein Kazeminia, Andrei A. Bulatov

Thumbnail PDF


  • Filesize: 0.57 MB
  • 13 pages

Document Identifiers

Author Details

Amirhossein Kazeminia
  • Simon Fraser University, Canada
Andrei A. Bulatov
  • Simon Fraser University, Canada


This work was supported by an NSERC Discovery grant

Cite AsGet BibTex

Amirhossein Kazeminia and Andrei A. Bulatov. Counting Homomorphisms Modulo a Prime Number. In 44th International Symposium on Mathematical Foundations of Computer Science (MFCS 2019). Leibniz International Proceedings in Informatics (LIPIcs), Volume 138, pp. 59:1-59:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2019)


Counting problems in general and counting graph homomorphisms in particular have numerous applications in combinatorics, computer science, statistical physics, and elsewhere. One of the most well studied problems in this area is #GraphHom(H) - the problem of finding the number of homomorphisms from a given graph G to the graph H. Not only the complexity of this basic problem is known, but also of its many variants for digraphs, more general relational structures, graphs with weights, and others. In this paper we consider a modification of #GraphHom(H), the #_{p}GraphHom(H) problem, p a prime number: Given a graph G, find the number of homomorphisms from G to H modulo p. In a series of papers Faben and Jerrum, and Göbel et al. determined the complexity of #_{2}GraphHom(H) in the case H (or, in fact, a certain graph derived from H) is square-free, that is, does not contain a 4-cycle. Also, Göbel et al. found the complexity of #_{p}GraphHom(H) when H is a tree for an arbitrary prime p. Here we extend the above result to show that the #_{p}GraphHom(H) problem is #_{p}P-hard whenever the derived graph associated with H is square-free and is not a star, which completely classifies the complexity of #_{p}GraphHom(H) for square-free graphs H.

Subject Classification

ACM Subject Classification
  • Theory of computation → Problems, reductions and completeness
  • graph homomorphism
  • modular counting
  • computational hardness


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


  1. Andrei A. Bulatov and Martin Grohe. The complexity of partition functions. Theor. Comput. Sci., 348(2-3):148-186, 2005. Google Scholar
  2. Jin-Yi Cai, Xi Chen, and Pinyan Lu. Graph Homomorphisms with Complex Values: A Dichotomy Theorem. In Automata, Languages and Programming, 37th International Colloquium, ICALP 2010, Bordeaux, France, July 6-10, 2010, Proceedings, Part I, pages 275-286, 2010. Google Scholar
  3. Martin Dyer and Catherine Greenhill. The complexity of counting graph homomorphisms. Random Structures and Algorithms, 17(3-4):260-289, 2000. Google Scholar
  4. John Faben and Mark Jerrum. The Complexity of Parity Graph Homomorphism: An Initial Investigation. Theory of Computing, 11:35-57, 2015. Google Scholar
  5. Andreas Galanis, Leslie Ann Goldberg, and Mark Jerrum. Approximately Counting H-Colorings is #BIS-Hard. SIAM J. Comput., 45(3):680-711, 2016. Google Scholar
  6. Andreas Galanis, Leslie Ann Goldberg, and Mark Jerrum. A Complexity Trichotomy for Approximately Counting List H-Colorings. TOCT, 9(2):9:1-9:22, 2017. Google Scholar
  7. Andreas Göbel, Leslie Ann Goldberg, and David Richerby. The Complexity of Counting Homomorphisms to Cactus Graphs Modulo 2. ACM Trans. Comput. Theory, 6(4):17:1-17:29, August 2014. Google Scholar
  8. Andreas Göbel, Leslie Ann Goldberg, and David Richerby. Counting Homomorphisms to Square-Free Graphs, Modulo 2. ACM Trans. Comput. Theory, 8(3):12:1-12:29, May 2016. Google Scholar
  9. Andreas Göbel, J. A. Gregor Lagodzinski, and Karen Seidel. Counting Homomorphisms to Trees Modulo a Prime. In 43rd International Symposium on Mathematical Foundations of Computer Science, MFCS 2018, August 27-31, 2018, Liverpool, UK, pages 49:1-49:13, 2018. Google Scholar
  10. Leslie Ann Goldberg, Martin Grohe, Mark Jerrum, and Marc Thurley. A Complexity Dichotomy for Partition Functions with Mixed Signs. SIAM J. Comput., 39(7):3336-3402, 2010. Google Scholar
  11. Leslie Ann Goldberg and Heng Guo. The Complexity of Approximating complex-valued Ising and Tutte partition functions. Computational Complexity, 26(4):765-833, 2017. Google Scholar
  12. Pavol Hell and Jaroslav Nešetřil. On the Complexity of H-coloring. Journal of Combinatorial Theory, Ser.B, 48:92-110, 1990. Google Scholar
  13. Pavol Hell and Jaroslav Nešetřil. Graphs and homomorphisms, volume 28 of Oxford Lecture Series in Mathematics and its Applications. Oxford University Press, 2004. Google Scholar
  14. László Lovász. Large Networks and Graph Limits, volume 60 of Colloquium Publications. American Mathematical Society, 2012. Google Scholar
  15. Leslie G. Valiant. The Complexity of Computing the Permanent. Theor. Comput. Sci., 8:189-201, 1979. Google Scholar
  16. Leslie G. Valiant. The Complexity of Enumeration and Reliability Problems. SIAM J. Comput., 8(3):410-421, 1979. Google Scholar
  17. Leslie G. Valiant. Accidental Algorthims. In Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science, FOCS '06, pages 509-517, 2006. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail