The Hamiltonian is a linear combination of the constraints $\{C_i\}$, with the coefficients $\{\theta_i\}$ being the conjugate Lagrange multipliers introduced in the constrained-maximization problem.

For the ECM, it is possible to show [@mastrandrea2013enhanced; @mybosefermi] that $$\label{maxlik}
P(W|\vec{x},\vec{y})=\prod_{i<j}q_{ij}(w_{ij}|\vec{x},\vec{y}),$$ where $\vec{x}$ and $\vec{y}$ are two $N$-dimensional Lagrange multipliers ($N$ stands for the number of nodes) controlling for the expected degrees and strengths respectively (with $x_i\ge 0$ and $0\le y_i<1$ for all $i$) and $q_{ij}(w|\vec{x},\vec{y})$ is the conditional probability to observe a link of weight $w$ between nodes $i$ and $j$. The latter has the explicit expression [@mybosefermi; @mastrandrea2013enhanced] $$\label{qw}
q_{ij}(w|\vec{x},\vec{y})=\frac{(x_{i}x_{j})^{\Theta(w)}(y_{i}y_{j})^{w}(1-y_{i}y_{j})}{1-y_{i}y_{j}+x_{i}x_{j}y_{i}y_{j}}.$$

The third step of the procedure prescribes to find the values of the Lagrange multipliers $\vec{x}^*,\vec {y}^*$ that maximize the log-likelihood of generating the observed weighted network $W^*$ (which is one particular network in the ensemble considered). The log-likelihood reads $$\mathcal{L}(\vec{x},\vec{y})\equiv
 \ln P(W^*|\vec{x},\vec{y})=\sum_{i<j}\ln q_{ij}(w^*_{ij}|\vec{x},\vec{y})$$ representing the logarithm of the probability to observe the empirical graph $W^*$. The maximization of the likelihood is equivalent to the requirement that the desired constraints are satisfied on average by the ensemble of networks [@mylikelihood], i.e. in this case $\langle k_i\rangle = k_i(W^*)$ and $\langle s_i\rangle = s_i(W^*)$ for all $i$ [@mastrandrea2013enhanced].

As a final step, one 