Decision variables¶
Let each of $2N$ binary variables $q$ correspond to each vertex in $G$ to indicate which set each
vertex
belongs to. For example, if $q=0$ is the vertex set denoted by blue and $q=1$ is the vertex set
denoted by
orange, the binary variable combinations corresponding to the partitioning in the figure below are
shown
in the table below.
Index of vertex |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
$q$ |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
Objective function¶
To solve the graph partitioning problem, we can determine the value of the decision variable $q$ so
as to
minimize the number of edges connecting vertices belonging to different sets.
For vertices $u$ and $v$ of $G$ to belong to different sets, the exclusive OR (xor) of $q_u$ and
$q_v$
must be 1, which is expressed as $-2q_u q_v + q_u + q_v$ in quadratic form. Among all pairs $(u, v)$
of
vertices connected by edges, the objective function is the minimum number of $(u, v)$ where $u$ and
$v$
belong to different sets. Therefore, the objective function is:
$$
\sum_{(u, v) \in E} \operatorname{xor}(q_u, q_v) = \sum_{(u, v) \in E} -2q_uq_v + q_u + q_v.
$$
Constraints¶
For the partition of the vertex set of $G$ represented by the decision variable $q$ to be two sets
consisting of $N$ vertices,
it is necessary and sufficient that there are $N$ binary variables, which are $0$ and $1$,
respectively.
Therefore, the sum of $q_i$ is $N$:
$$
\sum_{i = 0}^{2N-1}q_i = N.
$$