QCQI
QCQI
1 Abstract
This research investigates quantum approaches to solving the NP-complete Maximal Clique Prob-
lem, which requires exponential time for classical algorithms. Three quantum algorithms are proposed:
Reduction to SAT, Grover’s Algorithm, and Quantum Approximate Optimization Algorithm (QAOA).
The study compares these methods in terms of qubit requirements, time complexity, and performance.
Results show that quantum algorithms offer theoretical complexity advantages over classical methods,
while hybrid approaches like QAOA provide practical solutions for larger instances in the NISQ era.
Fine-tuning remains essential for optimal performance, presenting a promising pathway for addressing
NP-complete problems with quantum computing.
2 Introduction
2.1 Background
2.1.1 Maximal Clique Problem
The maximal clique problem involves finding all maximal cliques in a graph, where a clique is a
subset of vertices with all pairs connected, and a maximal clique cannot be extended further. This
problem is NP-hard, and a brute-force approach requires examining all subsets of vertices, leading to
a time complexity of O(2n · n2 ), where n is the number of vertices in the graph.
Page 1
Final Project B11902027 QCQI
While QAOA theoretically converges to the optimal solution as p → ∞, in practice, good ap-
proximations can be achieved with small p, balancing performance and accuracy.
Quadratic programming (QP) involves minimizing a quadratic function with linear constraints.
Quadratic Unconstrained Binary Optimization (QUBO), a special case of QP with no constraints
and binary variables, is particularly well-suited for QAOA, as the lack of constraints simplifies the
problem.
Page 2
Final Project B11902027 QCQI
• Clauses with one literal: For a clause with one literal, two dummy variables can be added to
transform it into 3-SAT clauses. For example, given the clause x0 , add y0 and y1 to transform
it into (x0 ∨ y0 ∨ y1 ) ∧ (x0 ∨ ¬y0 ∨ ¬y1 ) ∧ (x0 ∨ y0 ∨ ¬y1 ) ∧ (x0 ∨ ¬y0 ∨ y1 ).
• Clauses with two literals: For a clause with two literals, one dummy variable can be added.
For example, given the clause (x0 ∨ x1 ), add y0 to transform it into (x0 ∨ x1 ∨ y0 ) ∧ (x0 ∨ x1 ∨ ¬y0 ).
• Clauses with more than three literals: For a clause with k literals (k ≥ 4), add k − 3
dummy variables. For example, given (x1 ∨ x2 ∨ x3 ∨ · · · ∨ xk ), add y0 , y1 , . . . , yk−3 to transform
it into (x1 ∨ x2 ∨ y1 ) ∧ (¬y1 ∨ x3 ∨ y2 ) ∧ (¬y2 ∨ x4 ∨ y3 ) ∧ · · · ∧ (¬yk−3 ∨ xk−1 ∨ xk ).
Page 3
Final Project B11902027 QCQI
Variables Define Boolean variables xi,j , where i ∈ {1, . . . , k} represents the i-th position in the
clique, and j ∈ {1, . . . , n} represents the j-th vertex in the graph. xi,j = 1 indicates vertex vj occupies
position i in the clique.
• Position
Vk Wn Occupancy: Each position in the clique must be occupied by at least one vertex:
i=1 j=1 xi,j .
• No Repeated Vertices: A vertex cannot occupy more than one position: ¬xi,j ∨ ¬xi′ ,j for all
i ̸= i′ and j ∈ {1, . . . , n}.
• Connectivity: Only connected vertices can form a clique: ¬xi,p ∨ ¬xi′ ,q for all (vp , vq ) ∈
/ E and
i ̸= i′ .
A SAT solver checks the satisfiability of ϕ. If ϕ is satisfiable, the satisfying assignment corresponds
to a k-clique in G.
Page 4
Final Project B11902027 QCQI
To model the graph G, its adjacency matrix A is constructed. To ensure that each vertex connects
to itself, self-loops are added by defining A′ = A + I, where I is the identity matrix. Each column
of A′ , denoted as |Cj ⟩ = |c1j , c2j , . . . , cnj ⟩, is stored in a quantum register, with cij = 1 indicating a
connection between vertices i and j, and cij = 0 otherwise.
Ancillary qubits are employed to hold temporary data, such as the set of common neighbors,
which is essential for verifying clique conditions.
3.2.2 Oracle
The oracle identifies whether a quantum state |x⟩ represents a maximal clique. If |x⟩ corresponds
to a maximal clique, a phase flip is applied, changing |x⟩ to −|x⟩.
First, controlled-NOT operations perform a bitwise-AND between the graph data |Cj ⟩ and the
vertex subset encoded in |x⟩, identifying common neighbors of vertices in the candidate clique. The
operation is defined as:
(
cij , if xj = 1
xj cij ⊕ xj cij ⊕ xj cij =
1, if xj = 0
The ancilla qubits store these common neighbors, with each bit indicating whether a vertex is
shared among all vertices in |x⟩ (1 for common neighbor, 0 otherwise).
A Cn (X) operation is then applied, where the ancilla qubits act as controls, and |x⟩ serves as the
target. If the common neighbors match the vertices in |x⟩, the oracle flips |x⟩, confirming it represents
a maximal clique.
Page 5
Final Project B11902027 QCQI
3. Solve the QUBO problem using QAOA and estimate the result.
3.3.1 QP Formulation
The CLIQUE problem can be formulated as a Quadratic Programming (QP) problem.
1. Compute the complement of G, denoted as G = (V, E ′ ), where V is the set of vertices, and E ′
contains edges that are not present in G.
2. For each (vi , vj ) ∈ E ′ , add the constraint xi + xj ≤ 1. Here, V = {v0 , v1 , . . . , vn−1 }, and n = |V |.
This ensures that xi = 1 and xj = 1 cannot occur simultaneously, as (vi , vj ) ∈ E ′ would violate
the clique condition.
Page 6
Final Project B11902027 QCQI
The 3-SAT transformation introduces K(2N −3)+3[N K(K −1)+K(K −1)( N (N2−1) −E)] ∈ O(N 4 )
variables. Using the PhaseOracle object, the number of qubits in the quantum circuit equals the
variables in the 3-SAT problem.
Page 7
Final Project B11902027 QCQI
Page 8
Final Project B11902027 QCQI
2. QUBO Formulation (Classic): O(n2 ) to convert constraints into penalty terms and construct
the matrix Q.
3. Preparing for QAOA (Classic): O(n2 ) for Hamiltonian calculation and O(p) for preparing
⃗ resulting in O(n2 + p) overall.
parameters ⃗γ and β,
4. QAOA Execution (Quantum + Classic): O(p) per quantum iteration and O(n2 ) for the
classical optimizer, leading to O(n2 + p) overall.
Thus, the total time complexity of QAOA is O(n2 + p). For large n, this simplifies to O(n2 ), as
p is typically small.
Page 9
Final Project B11902027 QCQI
• Reduction to SAT: This method provides a systematic way to encode the CLIQUE problem
N3
as a Boolean satisfiability problem. While it scales poorly with the number of vertices (O(2 2 )),
it leverages classical SAT solvers effectively for small problem sizes.
• Grover’s Algorithm: By employing quantum search, this approach reduces the search space
quadratically compared to classical brute-force methods. However, its hardware requirements
and noise sensitivity restrict its practical applicability to small graphs in the current NISQ era.
• QAOA: This hybrid algorithm offers a promising trade-off between quantum and classical
computation. While its performance depends heavily on the choice of parameters and problem
size, QAOA shows potential for efficiently solving QUBO problems and is well-suited for near-
term quantum devices.
Page 10
Final Project B11902027 QCQI
6 References
[1] Chu Ryang Wi, Department of Electrical Engineering, University at Buffalo, State University of
New York, Buffalo, NY. A Quantum Circuit to Construct All Maximal Cliques Using Grover Search
Algorithm. arXiv preprint arXiv:1711.06146v2, 2018.
[2] Edward Farhi, Jeffrey Goldstone, and Sam Gutmann. A Quantum Approximate Optimization
Algorithm. arXiv preprint arXiv:1411.4028, 2014.
7 Appendix
The repository of the project could be found here.
Page 11