```
1OPENQASM 2.0;
2include "qelib1.inc";
3
4 // Initialization variables
5
6qreg q[3]; // This creates three qubits.
7 // The first two qubits, 0 and 1, representing the network of 4 nodes.
8 // The last qubit, 2, represents the quantum coin
9
10creg c[2]; // This creates two classical bits to store the outcome of measurements.
11
12
13 // Preparing the quantum coin
14h q[2]; // Rotate quantum coin into a superposition
15barrier q[0],q[1],q[2]; // Barriers are a way break circuit portions into sections.
16
17
18 // Quantum Walk Step
19
20cx q[2],q[0]; // Controlled-Not gate on qubit 0 conditioned on the coin. Also known as a shift.
21x q[2]; // Bit-flip (or X rotation) of the coin
22cx q[2],q[1]; // Controlled-Not gate on qubit 1 conditioned on the coin.
23barrier q[0],q[1],q[2]; // Barriers for readability of the quantum circuit
24
25 // This concludes one quantum walk step.
26 // What would you have to do to have more steps on the walk?
27
28
29 // Measurements
30 // To finish, we measure the whole network to determine where is the quantum walker.
31
32measure q[0] -> c[0]; // Measure qubit 0, store the outcome in bit 0.
33measure q[1] -> c[1]; // Measure qubit 1, store the outcome in bit 1.
34
35 // After the measurements, we an read out where the walker is.
36 // Since this is probabilistic, what yould you have to do to get statistics?
37
```