In the simplest case, let's assume we have distance 2 surface code. The X stabilizers will be: X1X2X3 and X3X4X5 which is shown by the red lines.

enter image description here

So the parity check matrix will be: $$ \begin{bmatrix} 1 & 1 & 1 &0 &0 \\ 0 & 0 & 1 &1 & 1 \end{bmatrix} $$ Now when I run the code scripts with pymatching to see how it works,

m =Matching()
m.load_from_check_matrix([[1, 1,1,0,0],[0,0,1,1,1]])

I get the following image as a result. I actually did not understand what this plot means. The empty circle is the boundary. Is it the boundary qubit? Filled circles (in this case 0 and 1) are the stabilizers. But I have just 2 filled circles. Does this mean that one of the filled circle is X1X2X3 and the other filled circle X3X4X5? I also did not understand the weights, for example why do we have 0 between boundary and the circle-0 and why do we have 3 between boundary and the circle-1? Can someone explain me what this plot represents? enter image description here


1 Answer 1


The networkX visualizations of the surface codes tend to be a little squished unfortunately. What you are looking at is the same as the image below, just slightly distorted.

enter image description here

This image should be more familiar as the normal unrotated distance 2 surface code graph. All that's happening is that the (1) edge is hidden behind the (0) edge, and the (4) edge behind the (3) edge. Part of the reason for the distortion is pymatching uses a single boundary node for the rough boundaries of the graph. This is why node (2) is depicted differently than the other nodes, it represents the boundary node.

  • $\begingroup$ Hi, thanks for the answer!. I have one question: you wrote "2" for every corner. Here I assume that you meant node 2. Is that correct? I guess the rest is as you said: since edge 4 will be behind edge2 and edge 1 will be behind edge 0 so I see 0,2,3 edges as weights. Although I do not fully understand the reason for why pymatching is using single boundary node for rough ones, it is much clear now. THanks $\endgroup$
    – quest
    Jan 12, 2023 at 3:42
  • $\begingroup$ Yes, my sloppy circle was meant to be a node. $\endgroup$
    – Ian
    Jan 12, 2023 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.