  For a set $S$ of vertices of a graph $G$, we define its density $0 \leq
\sigma(S) \leq 1$ as the ratio of the number of edges of $G$ spanned by the
vertices of $S$ to ${|S| \choose 2}$. We show that, given a graph $G$ with $n$
vertices and an integer $m$, the partition function $\sum_S \exp\{ \gamma m
\sigma(S) \}$, where the sum is taken over all $m$-subsets $S$ of vertices and
$0 < \gamma <1$ is fixed in advance, can be approximated within relative error
$0 < \epsilon < 1$ in quasi-polynomial $n^{O(\ln m - \ln \epsilon)}$ time. We
discuss numerical experiments and observe that for the random graph $G(n, 1/2)$
one can afford a much larger $\gamma$, provided the ratio $n/m$ is sufficiently
large.
