Skip to content

Circuit extraction#445

Open
matulni wants to merge 13 commits intoTeamGraphix:masterfrom
matulni:circuit-extraction
Open

Circuit extraction#445
matulni wants to merge 13 commits intoTeamGraphix:masterfrom
matulni:circuit-extraction

Conversation

@matulni
Copy link
Contributor

@matulni matulni commented Feb 18, 2026

This PR introduces functionality to perform the circuit extraction algorithm presented in Ref. [1] which allows to extract a circuit without ancillas from a strongly deterministic pattern.

Context

The main result of the paper is a procedure to perform the transformation

$$U_{\mathcal{P}} \rightarrow C V(\mathbf{\theta}),$$

where $U_{\mathcal{P}}$ is the isometry implemented by the pattern $\mathcal{P}$ (a unitary when the pattern has the same number of inputs and outputs), $C$ is a Clifford map, and $V(\mathbf{\theta})$ is an ordered product of Pauli exponentials.

The structure of the extraction process reads as follows:

flowchart LR

n0["Pattern"]
n1["OpenGraph"]
n2("Focused PauliFlow")

subgraph s1["ExtractionResult"]
    s10("PauliExponentialDAG")
    s11("CliffordMap")
end

%% Junction node to merge arrows
j1(( ))

n3("Graphix circuit")

n0 --> n1
n1 --> n2
n2 --> s10
n2 --> s11

%% Merging into the junction
s10 --> j1
s11 --> j1
j1 --> n3

%% Styling the junction to be small
style j1 fill:#000,stroke-width:0px,width:10px
Loading
  • The transformation Pattern -> OpenGraph -> Focused PauliFlow already exists in the current implementation of Graphix. The $O(N^3)$ Pauli-flow extraction algorithm in Ref. [2] always returns focused Pauli flows, contrary to the $O(N^5)$ version in Ref. [1] which requires an additional post-processing to focus the correction function.

  • ExtractionResult is the output of the algorithm which is denoted "PdDAG" in [1]. In particular:

    • PauliExponentialDAG is a mapping between measured nodes in the open graph and Pauli exponentials, and a partial order between the measured node (the flow's partial order). Pauli exponentials are a pair of an Angle (the node's measurement angle) and a PauliString acting on the output nodes of the open graph. The corresponding Pauli string is obtained from the focused flow's correction function.

    • Clifford Map describes a linear transformation between the space of input qubits and the space of output qubits. It is encoded as a map from the Pauli-group generators ($X$ and $Z$) over the input nodes to Pauli strings over the output nodes.

      The $Z$-map is also obtained from the focused flow's correction function. The $X$-map is obtained from the focused flow's correction function of the extended open graph (see Def. C.3 in [1]).

Summary of changes

  • Added the following to graphix.flow.core.PauliFlow:

    • is_focused : (method) Verifies if a Pauli flow is focused according to definition 4.3 in Ref. [1].
    • extract_circuit : (method) Returns a ExtractionResult object.
    • pauli_strings : (cached_property) Associates a Pauli string to every corrected node in the flow's correction function.
  • Added new module graphix.circ_ext.extraction

    • This module contains the machinery to perfom the transformation Focused PauliFlow -> ExtractionResult.
    • We introduce the following (self-descriptive) classes:
      • ExtractionResult
      • PauliString
      • PauliExponential
      • PauliExponentialDAG
      • CliffordMap
  • Added new module graphix.circ_ext.compilation

    • This module contains the machinery to perform the transformation ExtractionResult -> Graphix circuit.
    • It lays out a structure of abstract compilation passes which will allow in the future to experiment with different strategies. Currently:
      • The transformation PauliExponentialDAG -> Graphix circuit is done with the naive "star" construction (see [3]).
      • The transformation CliffordMap -> Graphix circuit relies on stim and currently only supports unitaries (i.e., patterns with the same number of inputa and outputs). To avoid introducing a dependency on stim, the StimCliffordPass is implemented in the external plugin graphix-stim-compiler. This compilation pass together with the tooling introduced in this PR allow to do a round-trip conversion circuit -> MBQC pattern -> circuit.

We note that all the transformations in the figure work with parametric objects as well.

References

[1] Simmons, 2021, arXiv:2109.05654.

[2] Mitosek and Backens, 2024, arXiv:2410.23439.

[3] https://quantumcomputing.stackexchange.com/questions/5567/circuit-construction-for-hamiltonian-simulation/11373#11373

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 82.69231% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.56%. Comparing base (03a89c9) to head (5a49b55).

Files with missing lines Patch % Lines
graphix/circ_ext/extraction.py 83.15% 16 Missing ⚠️
graphix/circ_ext/compilation.py 84.09% 14 Missing ⚠️
graphix/flow/core.py 76.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #445      +/-   ##
==========================================
- Coverage   88.76%   88.56%   -0.20%     
==========================================
  Files          44       46       +2     
  Lines        6308     6516     +208     
==========================================
+ Hits         5599     5771     +172     
- Misses        709      745      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments