I'm currently reading thisa paper (https://arxiv.org/pdf/1412.0756.pdfabstract here) paper on the statistical mechanics of RGGsRandom Geometric Graphs, and they start with the statistical mechanics of hidden variable graphs.
They've taken $a_{ij}$ as the components of the adjacency matrix, $\rho(h_i)$ as the probability for node $i$ to have hidden variable $h_i$, and $p(h_i,h_j)$ as the probability that nodes with $h_i$ and $h_j$ are connected. From this they get the following path integral for the partition function
$Z(\mu) = \int \prod_i dh_i \rho(h_i) \sum_{\{a_{ij}\}}\prod_{i<j} p(h_i,h_j)^{a_{ij}}(1 - p(h_i,h_j))^{1-a_{ij}} e^{\mu \sum_{i<j}a_{ij}}$
which is alright, but then they do the sum over the $\{a_{ij}\}$ and get
$Z(\mu) = \int \prod_i dh_i \exp \big(\sum_i \ln[\rho(h_i)] + \sum_{i<j} \ln[p(h_i,h_j)e^{\mu} -p(h_i,h_j) +1] \big)$
It's clear to me that that the first term in the exponential corresponds to the product of $\rho(h_i)$ but I'm not really sure how to begin on the sum over $\{a_{ij}\}$. I thought to use something similar to the transfer matrix method from the 1D ising model, but I can't really figure out how to properly reapply it here. I was also unable to find any reading on doing sums over ensembles like this, but from the way its mentioned in the paper it appears as though its rather standard, so just knowing the proper name for this might be helpful as well.