A modular Graph State qompiler for measurement-based quantum computing.
Project description
GraphQOMB
GraphQOMB (Qompiler for Measurement-Based Quantum Computing, pronounce as graphcomb) is a modular graph-based compiler for measurement-based quantum computing (MBQC), providing a high-level interface to the graphix package for applications such as fault-tolerant MBQC.
GraphQOMB's philosophy is to use graph-like ZX diagrams as MBQC representation, with feedforward strategy treated independently. This allows, for example, to integrate Pauli frame tracking needed for fault-tolerant MBQC, into basic feedforward strategy of MBQC, allowing streamlined compilation.
Features
Computation Design
- ZX-Calculus Integration: Use ZX-diagrams as an abstract expression of measurement pattern
- Feedforward Strategy Design: Our library accepts general feedforward strategy and optimization, eliminating the necessity of measurement calculus
- Scheduler: Scheduling the node preparation and measurement time
Compilation
- MBQC Pattern Generation: Measurement pattern is treated as a quantum assembly
- Pauli Frame Tracking: Manage all the classical feedforward with Pauli Frame, enabling fault-tolerant computing as well
Simulation
- Pattern Simulation: Simulate measurement patterns with statevector backend
- Simulation in Stim circuit: Generate a stim circuit implementing a fault-tolerant MBQC
Others
- Transpilation into Graphix Pattern: Transpile generated pattern into
graphix.pattern.Patternobject for variety of execution backend (WIP) - Visualization: Visualize graph states
Installation
From PyPI (Recommended)
pip install graphqomb
From Source (Development)
git clone https://github.com/TeamGraphix/graphqomb.git
cd graphqomb/
pip install -e .
Install with development dependencies:
pip install -e .[dev]
Install with documentation dependencies:
pip install -e .[doc]
Quick Start
Prepare Resource State and Feedforward
from graphqomb.circuit import Circuit, circuit2graph
from graphqomb.gates import H, CNOT
from graphqomb.qompiler import qompile
from graphqomb.simulator import PatternSimulator, SimulatorBackend
# Create a quantum circuit
circuit = Circuit(2)
circuit.apply_macro_gate(H(0))
circuit.apply_macro_gate(CNOT((0, 1)))
graph, feedforward = circuit2graph(circuit)
# Compile into pattern
pattern = qompile(graph, feedforward)
# Simulate the pattern
simulator = PatternSimulator(pattern, SimulatorBackend.StateVector)
simulator.simulate()
print(simulator.state)
Creating and Visualizing Graph States
from graphqomb.graphstate import GraphState
from graphqomb.visualizer import visualize
# Create a graph state using from_graph
graph, node_map = GraphState.from_graph(
nodes=["input", "middle", "output"],
edges=[("input", "middle"), ("middle", "output")],
inputs=["input"],
outputs=["output"]
)
# Visualize the graph
visualize(graph)
Documentation
- Tutorial: [WIP] for detailed usage guides
- Examples: See examples for code demonstrations
- API Reference: Full API documentation is available here
Development
Running Tests
pytest # Run all tests
pytest tests/test_specific.py # Run specific test file
Code Quality
ruff check # Lint code
ruff format # Format code
mypy # Type checking
pyright # Type checking
Building Documentation
cd docs/
make html # Build HTML documentation
# Output will be in docs/build/html/
Project Structure
graphqomb/
├── graphqomb/ # Main source code
│ ├── circuit.py # Quantum circuit implementation
│ ├── graphstate.py # Graph state manipulation
| ├── scheduler.py # Scheduling computaional order
│ ├── qompiler.py # Generate MBQC pattern
│ ├── simulator.py # Pattern simulation
│ ├── visualizer.py # Visualization tools
│ └── ...
├── tests/ # Test suite
├── examples/ # Example scripts
├── docs/ # Sphinx documentation
│ └── source/
│ ├── gallery/ # Example gallery
│ └── ...
└── pyproject.toml # Project configuration
Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Ensure all tests pass and code is properly formatted
- Submit a pull request
Related Projects
- graphix: The original MBQC library
- PyZX: ZX-calculus library for Python
- swiflow: Rust-based fast flow finding algorithms
License
Citation
If you use GraphQOMB in your research, please cite:
@software{graphqomb,
title = {GraphQOMB: A Modular Graph State Qompiler for Measurement-Based Quantum Computation},
author = {Masato Fukushima, Sora Shiratani, Yuki Watanabe, and Daichi Sasaki},
year = {2025},
url = {https://github.com/TeamGraphix/graphqomb}
}
Acknowledgements
We acknowledge the NICT Quantum Camp for supporting our development.
Special thanks to Fixstars Amplify:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graphqomb-0.2.1.tar.gz.
File metadata
- Download URL: graphqomb-0.2.1.tar.gz
- Upload date:
- Size: 79.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d49d70b0065e32ea4cc8872c328529d300c72f47026636c70f557a2fc9889442
|
|
| MD5 |
614fe1539d0a994fdf44af9fc3a76ccc
|
|
| BLAKE2b-256 |
82424a0ade700c1e425de35a46455f9a9079a3a1cf80e082998ca025680d4fc2
|
Provenance
The following attestation bundles were made for graphqomb-0.2.1.tar.gz:
Publisher:
publish-to-pypi.yml on TeamGraphix/graphqomb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphqomb-0.2.1.tar.gz -
Subject digest:
d49d70b0065e32ea4cc8872c328529d300c72f47026636c70f557a2fc9889442 - Sigstore transparency entry: 842006455
- Sigstore integration time:
-
Permalink:
TeamGraphix/graphqomb@ad07ddf6eb8aaa5902173e5d76d55c04aeb19479 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/TeamGraphix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ad07ddf6eb8aaa5902173e5d76d55c04aeb19479 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphqomb-0.2.1-py3-none-any.whl.
File metadata
- Download URL: graphqomb-0.2.1-py3-none-any.whl
- Upload date:
- Size: 57.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2295ab3d4e5d5c3b9d9e8b57bde0c36b14f3e867ee30115e71ba6b9555e4d6e9
|
|
| MD5 |
5caa833a8bbeda04eca20263ee7a0e02
|
|
| BLAKE2b-256 |
181f85bb2d4e1888eb8ccaeb9c1d0fa9e13cdc4e7c974de2fd3d2426a0993085
|
Provenance
The following attestation bundles were made for graphqomb-0.2.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on TeamGraphix/graphqomb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphqomb-0.2.1-py3-none-any.whl -
Subject digest:
2295ab3d4e5d5c3b9d9e8b57bde0c36b14f3e867ee30115e71ba6b9555e4d6e9 - Sigstore transparency entry: 842006463
- Sigstore integration time:
-
Permalink:
TeamGraphix/graphqomb@ad07ddf6eb8aaa5902173e5d76d55c04aeb19479 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/TeamGraphix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ad07ddf6eb8aaa5902173e5d76d55c04aeb19479 -
Trigger Event:
push
-
Statement type: