Repository navigation
Conversation
…eck_well_formed - Add numpy-style docstrings to find_cflow, find_ecflow and _find_flow, and make _find_flow copy yz_candidates instead of mutating the caller's set. - Fix stale ExtendedCausalFlow/CausalFlow docstrings: ExtendedCausalFlow derives from GFlow and labels measurements by plane (no Pauli labelling), CausalFlow derives from ExtendedCausalFlow and no longer overrides to_xzcorrections. Restore a causal-flow-specific CausalFlow.check_well_formed docstring and document _check_xzplane and _check_yzplane. - Fix return types (_AM_co -> _PM_co), add Raises sections, and update references in XZCorrections.to_extendedcausalflow, OpenGraph.to_extendedcausalflow(_or_none) and SpaceMinimizationHeuristics.extended_causal_flow. - Add ExtendedCausalFlow cases to TestIncorrectFlows (XZPlane, YZ input, domain, C0, C1, CYZ, C2, C3, incomplete order) and a CausalFlow case on an open graph with YZ measurements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…imization - Simplify the yz_candidates description in _find_flow. - Explain why CausalFlow.check_well_formed is overridden. - Test XZCorrections.to_extendedcausalflow on an open graph with a YZ-measured node (round trip through XZ-corrections). - Test that the extended_causal_flow space minimization heuristic applies, is optimal and preserves semantics on a pattern without causal flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Update extended causal flow docstrings and test ExtendedCausalFlow.check_well_formed See merge request muldemol/graphix!2
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #651 +/- ##
==========================================
+ Coverage 89.98% 90.01% +0.02%
==========================================
Files 49 49
Lines 8447 8499 +52
==========================================
+ Hits 7601 7650 +49
- Misses 846 849 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
thierry-martinez
left a comment
There was a problem hiding this comment.
Thank you very much for extracting this!
| Specific properties of causal flows: | ||
| - Correction sets have one element only (C0), | ||
| - :math:`i \sim c(i)` (C1), | ||
| - :math:`i \prec c(i)` (C2), | ||
| - :math:`\forall k \in N_G(c(i)) \setminus \{i\}, i \prec k` (C3), | ||
| where :math:`i \in O^c`, :math:`c` is the correction function and :math:`\prec` denotes the partial order. | ||
|
|
||
| Causal flows are defined on open graphs with XY measurements only. | ||
|
|
||
| See Definition 2 in Ref. [1]. |
There was a problem hiding this comment.
That involves a lot of duplication, even in the documentation, just to specialize the docstring. I would rather describe the specific properties of causal flows in the class docstring and remove the method override.
There was a problem hiding this comment.
You are right. Commit 1efec45 refactors the dcostrings so that all flow definitions are in the class docstrings and check_well_formed methods are minimal. To ensure consistency, docstrings in other flow classes are modified.
| ----- | ||
| See notes in :meth:`to_causalflow`. | ||
| """ | ||
| return self.to_xzcorrections().downcast_bloch().to_extendedcausalflow() |
There was a problem hiding this comment.
Could we cover this line in tests?
- State the definition of each flow (Pauli flow, gflow, extended causal flow, causal flow) in the Notes section of its class docstring. The general properties shared by all flows are stated once, in PauliFlow, and referenced from the subclasses. - Shorten check_well_formed and check_flow_properties docstrings to say that they check flow validity and to refer to the class docstring for the definition. - Remove CausalFlow.check_well_formed, which was overridden only for its docstring. - Point the Focused* class docstrings to the flow and focus definitions, fix broken :meth: roles and the reason documented in CausalFlow._check_yzplane (YZPlane). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This PR addresses #613 and introduces support for extended causal flows as defined in arXiv:2608.13035.
The new class
ExtendedCausalFlowinherits fromGFlowand is the parent ofCausalFlow. It comes with the following tooling:XZCorrectionsXZCorrections(via inheritance)Space-minimization heuristic
causal_flowis replaced byextended_causal_flowwhich is more general, optimal, and equally costly.Further, because extended causal flows are more general than causal flows, and the extraction algorithm has the same complexity in both cases,
Pattern.drawandOpenGraph.to_patternare updated to look for an extended causal flow instead.