From patterns to corrections and back¶
So far, we have seen two ways to describe an MBQC computation: XZ-correction maps defined on an open graph and patterns in the measurement calculus. These two representations are closely related, and Graphix lets you convert freely from one to the other.
Every pattern has a unique underlying open graph and defines a unique correction map. Conversely, a computation given as an open graph with correction maps, \((\Gamma, \alpha, \boldsymbol{x}, \boldsymbol{z})\), corresponds to the following pattern [PS16]:
where the \(\prec\) is the partial order induced by the correction maps.
The method Pattern.to_xzcorrections() gives the graph-based
representation of a pattern. Conversely, you can go from
\((\Gamma, \alpha, \boldsymbol{x}, \boldsymbol{z})\) back to a pattern with
XZCorrections.to_pattern():
from graphix import Pattern
from graphix.command import N, E, M, X, Z
pattern = Pattern(input_nodes=[0], cmds=[N(1), E((0, 1)), M(0), N(2), E((1, 2)), X(1, {0}), M(1), Z(2, {0}), X(2, {1})])
xz_corr = pattern.to_xzcorrections()
print(xz_corr)
pattern_bis = xz_corr.to_pattern()
print(pattern_bis)
x(0) = {1}, x(1) = {2}; z(0) = {2}; {0} < {1} < {2}
X(2,{1}) M(1) X(1,{0}) Z(2,{0}) M(0) E(1,2) E(0,1) N(2) N(1)
If you only need the underlying open graph, Pattern.to_opengraph()
returns it directly. The opposite direction is trickier: an open graph does
not carry correction information, so turning it into a pattern is only
possible when a valid correction strategy can be found. That is the job of
the flow machinery, which we cover in the next tutorial.
References¶
Simon Perdrix and Luc Sanselme. Determinism and computational power of real measurement-based quantum computation. arXiv:1610.02824, 2016. URL: https://arxiv.org/abs/1610.02824.