Quantum walk algorithms turn the ballistic spreading of a quantum walk into a directed search.
Instead of spreading uniformly across a graph, the walk is designed so that amplitude accumulates
at a specially marked vertex — the target node. For the complete graph on N nodes, this approach
reproduces Grover's algorithm, achieving the quadratic speedup over classical unstructured search.
Searching on the complete graph
Consider the complete graph KN: every pair of nodes is connected, so every node is reachable
from every other node in a single step. We model the walker's position using n=⌈log2N⌉
position qubits. For N=4 nodes, two qubits suffice and the four nodes are labeled
∣00⟩,∣01⟩,∣10⟩,∣11⟩.
One marked node ∣m⟩ is distinguished. The goal is to concentrate the walker's probability
on ∣m⟩ as quickly as possible.
The two-part walk step
Each walk step consists of two unitaries applied in sequence:
Oracle — applies a phase flip to the marked node only:
O=I−2∣m⟩⟨m∣.
For the marked node ∣m⟩=∣11⟩ and two position qubits, O is realized by a
single controlled-Z gate:
CZ∣11⟩=−∣11⟩,CZ∣xy⟩=∣xy⟩ for ∣xy⟩=∣11⟩.
Grover coin (diffusion operator) — reflects every amplitude about the mean of the uniform
superposition ∣s⟩=N1∑x∣x⟩:
D=2∣s⟩⟨s∣−I.
In circuit form, D=H⊗n(2∣0⟩⟨0∣−I)H⊗n.
The inner phase-flip 2∣0⟩⟨0∣−I is realized as −X⊗nCZX⊗n
(since X⊗nCZX⊗n=I−2∣0⟩⟨0∣), giving the two-qubit coin circuit
H⊗nX⊗nCZX⊗nH⊗n, which equals −D and differs
from D only by a global phase that does not affect measurement outcomes.
Why one step suffices for N=4
Starting from the equal superposition ∣s⟩ (all four nodes equally likely), the geometry of
the two reflections determines how quickly the state rotates toward ∣m⟩. The initial
overlap between ∣s⟩ and ∣m⟩ is ⟨m∣s⟩=N1. The
angle between ∣s⟩ and the marked-state subspace is
θ=arcsin(N1).
Each walk step rotates the state by 2θ toward ∣m⟩. After k steps the overlap with
∣m⟩ is sin2((2k+1)θ). To reach probability 1 we need
k=⌊4θπ⌋≈4πN.
For N=4 we get θ=arcsin(1/2)=π/6, so k=⌊π/(4⋅π/6)⌋=⌊3/2⌋=1.
A single step is enough to land exactly on ∣11⟩ with probability 1.
The full circuit
For N=4 and target ∣m⟩=∣11⟩, the search circuit is:
After this single walk step, measuring yields ∣11⟩ with certainty.
Try it
Implement the four-step walk search circuit: prepare the uniform superposition, apply the oracle,
apply the Grover coin, then measure. The grader checks the output distribution — all probability
should appear on node ∣11⟩ (bitstring 11).
Run your code to see the quantum state.
After running, open the Probabilities tab to see a single bar at outcome 11 with height 1.
That is the quantum walk delivering the marked node with certainty in one step.
Sign in on the full site to ask questions and join the discussion.