Let $N$ be the number of vertices in $G$ below.
Decision variables¶
Let each of $N$ binary variables $q$ correspond to each vertex to indicate whether it is included in
the
clique. If the clique includes vertex $i$, $q_i$ is $1$, and if not, $0$.
For example, a clique consisting of vertex 1, vertex 3, vertex 4, and vertex 6 as shown in the figure
below, is represented as in the table below.
Index of vertex |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
$q$ |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
Objective function¶
Since the size of the clique should be as large as possible, the objective function is:
$$
-\sum_{i = 0}^{N - 1} q_i
$$
We added the minus sign to make the maximization problem a minimization problem.
Constraints¶
For the binary variable $q$ to correspond to a clique, we must impose the constraint that "an edge
connects every vertex in the clique." Using this contraposition, we can rephrase the condition as "if
vertices $u$ and $v$ are not connected by an edge, then at least one of $u$ and $v$ is not contained
in
the clique." We can write the condition as:
$$
q_uq_v = 0 \quad\text{for}\quad (u, v) \notin E
$$
Here, $E$ is the edge set of $G$.