How qat-inria/graphix-jcz-transpiler works
Project type and purpose
• This is an open-source Python library (“graphix_jcz_transpiler”) that implements a transpiler converting quantum circuits into MBQC patterns via the J-∧z decomposition.
• Its primary use case is as a straightforward, literature-faithful transpiler component within the broader Graphix ecosystem.
File structure
• Top-level files and folders:
• graphix_jcz_transpiler/ ← source package
– __init__.py
– jcz_transpiler.py ← main algorithm implementation
• tests/ ← PyTest test suite
• .github/workflows/test.yml ← CI pipeline
• pyproject.toml, requirements*.txt ← packaging and dependencies
README for additional insights
• Implements J-∧z decomposition based on “The Measurement Calculus” paper.
• Emphasis on transparency and correctness over heavy optimization.
• Integrates with Graphix’s circuit data structures and produces MBQC pattern objects compatible with Graphix.
a. Main components
1. Input Interface
• Accepts a Graphix quantum-circuit object (or equivalent AST).
2. JCZ Decomposer Module (jcz_transpiler.py)
• Core algorithm: decomposes gates into J(α) and ∧Z operations, sequences measurement commands.
3. Pattern Generator
• Transforms decomposition output into an MBQC pattern data structure.
4. Output Interface
• Returns or serializes the pattern object back to Graphix or to disk (e.g., JSON/YAML).
5. Auxiliary Components
• Configuration & utilities (if any in jcz_transpiler.py)
• Testing harness (tests/test_jcz_transpiler.py)
• CI & pre-commit checks (GitHub Actions, .pre-commit-config)
b. Relationships and interactions
• Input Interface → JCZ Decomposer → Pattern Generator → Output Interface
• Tests invoke Input Interface and verify output patterns against expected behavior
• CI pipeline runs tests on every push/PR
c. Architectural patterns & principles
• Pipeline pattern: clear linear flow of data through decomposer then generator
• Single Responsibility: separation of parsing, decomposition, and pattern construction
• Modular Python packaging for easy installation and reuse
d. Key technologies
• Python 3.x (pyproject.toml)
• PyTest for testing
• GitHub Actions for CI
• Graphix library (external dependency)