  In this paper we propose and realize (the code is publicly available at
https://github.com/Thrawn1985/2D-Partition-Function) an algorithm for exact
calculation of partition function for planar graph models with binary spins.
The complexity of the algorithm is O(N^2). Test experiments shows good
agreement with Onsager's analytical solution for two-dimensional Ising model of
infinite size.
