Solution (source code)

= Solution

For $\omega\in\{0,1\}^{E(G)}$, write $o(\omega)$ and $c(\omega)$ for its numbers of open and closed edges and $k(\omega)$ for the number of connected components of the open spanning subgraph. The free <random-cluster model> is
$$
\mathbb P_{\mathrm{FK}}^{p,q}(\omega)
=\frac1{Z_G(p,q)}
p^{o(\omega)}(1-p)^{c(\omega)}q^{k(\omega)}.
$$