A surface code stores one qubit in many. Tap a data qubit to give it a bit flip: the checks around it light up. Then decode, and watch Union-Find grow clusters around the lit checks until it can explain them.
If the flips and the correction together reach from the left side to the right side, the stored qubit is flipped: a logical error.
This is backlog's reference decoder, ported line
for line from C++ and checked against it edge for edge (tests/test_demo.py).
The C++ decoder computes the same answer with events instead of rounds, and adds edge
weights from the noise model, measurement errors over time, and correlated decoding.
pip install backlog-qec ·
how the C++ decoder works