Assume a complete undirected graph $G'=(\mathcal{V}',\mathcal{E}')$ and the partirion function:

$$\sum_{\boldsymbol{x}\in \{-1,+1\}^n} \prod_{\left(i,j\right)\in \mathcal{E}'} \left[1+x_{i}x_{j}\theta_{i,j}\right],\quad \theta_{\emptyset}=0$$ I would like to expand the product and then sum to find the expanded form of the partition function and I noticed that the only terms which will not sum up to zero after the summation are those for which $$\prod_{(i,j)\in \epsilon }x_i x_j \theta_{i,j}=\pm \prod_{(i,j)\in \epsilon }\theta_{i,j} \quad \forall x_i x_j \in\{-1,+1\} $$ for all the subsets $\epsilon \subset \mathcal{E}$, otherwise the corresponding product will sum up to zero after the summation. Then I tried to solve the equation above and we have the following: find the relationship between $i,j$ for all the pairs $(i,j)$ such that $$\prod_{(i,j)\in \epsilon }x_i =\pm \prod_{(i,j)\in \epsilon } x_j\quad \forall x_i x_j \in\{-1,+1\}$$. It seems like for each $x_i$ which participates to left handside $m$ times should appear $m$ times to the right as $\pm x_{i}$. My intuition is that the graph which is formed from all the edges of each set $\epsilon \subset \mathcal{E}$ such that the above equation is satisfied is a graph with (disconnected) cycles (two regular). To solve this I think it is sufficient to solve the following:

Let $G=(\mathcal{V},\mathcal{E})$ be an undirected graph with $\mathcal{E}=\{(i_r,j_r)$: for $r\in\{1,2.\ldots,R\}\}$. Assume that the sequence of indicies $i_1,i_2,\ldots,i_R\in\mathcal{V}$ is a permutation of $j_1,j_2,\ldots,j_R\in\mathcal{V}$ and not all the permutations are allowed since : it can not exist an edge of the form $(i,i)$ and $(i,j)\equiv(j,i)$. Is it always true that the Graph $G$ is a Hamiltonian cycle or a collection of (disjointed) hamiltonian cycles?

Since I can not find a counterexample I am trying to prove it as follows: Consider the permutation mapping $M:I \rightarrow J$ then for any $(i_k,j_k)\in \mathcal{E}$ we have $(i_k,j_k)=(i_k,M(i_k))$ and we can write the edges in the following order:$$(i_k,M(i_k)),(M(i_k),M(M(i_k))),(M(M(i_k)),M(M(M(i_k)))),\ldots, (M^{R}(i_k),i_k)$$. Is this sufficient?