Skip to main content Accessibility help

Weighted counting of solutions to sparse systems of equations

  • Alexander Barvinok (a1) and Guus Regts (a2)


Given complex numbers w1,…,wn, we define the weight w(X) of a set X of 0–1 vectors as the sum of $w_1^{x_1} \cdots w_n^{x_n}$ over all vectors (x1,…,xn) in X. We present an algorithm which, for a set X defined by a system of homogeneous linear equations with at most r variables per equation and at most c equations per variable, computes w(X) within relative error > 0 in (rc)O(lnn-ln) time provided $|w_j| \leq \beta (r \sqrt{c})^{-1}$ for an absolute constant β > 0 and all j = 1,…,n. A similar algorithm is constructed for computing the weight of a linear code over ${\mathbb F}_p$ . Applications include counting weighted perfect matchings in hypergraphs, counting weighted graph homomorphisms, computing weight enumerators of linear codes with sparse code generating matrices, and computing the partition functions of the ferromagnetic Potts model at low temperatures and of the hard-core model at high fugacity on biregular bipartite graphs.


Corresponding author

*Corresponding author. Email:


Hide All

Research partially supported by NSF grant DMS 1361541.

Research supported by a personal NWO Veni grant.



Hide All
[1]Ausiello, G., Crescenzi, P., Gambosi, G., Kann, V., Marchetti-Spaccamela, A., and Protasi, M. (1999) Complexity and Approximation: Combinatorial Optimization Problems and their Approximability Properties, Springer.
[2]Barvinok, A. (2016) Combinatorics and Complexity of Partition Functions, Vol. 30 of Algorithms and Combinatorics, Springer.
[3]Barvinok, A. (2017) Computing the partition function of a polynomial on the Boolean cube. In A Journey Through Discrete Mathematics (Loebl, M., et al., eds), Springer, pp. 135164.
[4]Barvinok, A. (2018) Computing permanents of complex diagonally dominant matrices and tensors. Israel J. Math., to appear. arXiv:1801.04191
[5]van den Berg, J. and Steif, J. E. (1994) Percolation and the hard-core lattice gas model. Stoch. Process. Appl. 49 179197.
[6]Berlekamp, E. R, McEliece, R. J. and van Tilborg, H. C. A. (1978) On the inherent intractability of certain coding problems. IEEE Trans. Inform. Theory 24 384386.
[7]Borgs, C., Chayes, J., Kahn, J., and Lovász, L. (2013) Left and right convergence of graphs with bounded degree. Random Struct. Alg. 42 128.
[8]Bruck, J. and M. Naor, M. (1990) The hardness of decoding linear codes with preprocessing. IEEE Trans. Inform. Theory 36 381385.
[9]Bukh, B. (2015) Personal communication.
[10]Cai, J.-Y., Galanis, A., Goldberg, L. A., Guo, H., Jerrum, M., Štefankovič, D. and Vigoda, E. (2016) #BIS-hardness for 2-spin systems on bipartite bounded degree graphs in the tree non-uniqueness region. J. Comput. System Sci. 82 690711.
[11]Chen, S., Delcourt, M., Moitra, A., Perarnau, G., and Postle, L. (2019) Improved bounds for randomly sampling colorings via linear programming. In Proc. Thirtieth Annual ACM–SIAM Symposium on Discrete Algorithms, SIAM, pp. 22162234.
[12]Csikvári, P. and Frenkel, P. E. (2016) Benjamini–Schramm continuity of root moments of graph polynomials. Europ. J. Combin. 52 (part B), 302320.
[13]Diestel, R. (2005) Graph Theory, third edition, Vol. 173 of Graduate Texts in Mathematics, Springer.
[14]Friedli, S. and Velenik, Y. (2018) Statistical Mechanics of Lattice Systems: A Concrete Mathematical Introduction, Cambridge University Press.
[15]Helmuth, T., Perkins, W., and Regts, G.(2018) Algorithmic Pirogov–Sinai theory. In Proceedings of the 51st Annual ACM Symposium on the Theory of Computing (STOC 2019).
[16]Jenssen, M., Keevash, P., and Perkins, W.(2019) Algorithms for #BIS-hard problems on expander graphs. In Proc. Thirtieth Annual ACM–SIAM Symposium on Discrete Algorithms, SIAM, pp. 22352247.
[17]Krantz, S. G. (1992) Function Theory of Several Complex Variables, second edition, Wadsworth & Brooks/Cole Mathematics Series, Wadsworth & Brooks/Cole.
[18]van Lint, J. H. (1999) Introduction to Coding Theory, third edition, Vol. 86 of Graduate Texts in Mathematics, Springer.
[19]Liu, J., Sinclair, A., and Srivastava, P.(2019) The Ising partition function: Zeros and deterministic approximation. J. Statist. Phys. 174, 287315.
[20]Mézard, M. and Montanari, A. (2009) Information, Physics, and Computation, Oxford Graduate Texts, Oxford University Press.
[21]Patel, V. and Regts, G. (2017) Deterministic polynomial-time approximation algorithms for partition functions and graph polynomials. SIAM J. Comput. 46 18931919.
[22]Patel, V. and Regts, G. (2017) Computing the number of induced copies of a fixed graph in a bounded degree graph. Algorithmica. doi: 10.1007/s00453-018-0511-9
[23]Valiant, L. G. (1979) The complexity of computing the permanent. Theoret. Comput. Sci. 8 189201.
[24]Valiant, L. G. and Vazirani, V. V. (1986) NP is as easy as detecting unique solutions. Theoret. Comput. Sci. 47 8593.
[25]Vigoda, E. (2000) Improved bounds for sampling colorings. J. Math. Phys. 41 15551569.

MSC classification

Weighted counting of solutions to sparse systems of equations

  • Alexander Barvinok (a1) and Guus Regts (a2)


Altmetric attention score

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed