Skip to main content

GraphQOMB

License PyPI version Python Versions Documentation Status codecov pytest typecheck Ruff

GraphQOMB (Qompiler for Measurement-Based Quantum Computing, pronounced graphcomb) is a compiler framework for measurement-based quantum computation (MBQC). It keeps the resource-state structure, classical feedforward, and execution schedule as separate first-class objects, then lowers them to an executable measurement pattern with a Pauli frame.

This design makes GraphQOMB useful both as an executable MBQC compiler and as a foundation for fault-tolerant workflows. The same core pipeline can be used to build patterns, study schedule-dependent resource tradeoffs, simulate them with statevector or density-matrix backends, and export compatible patterns to Stim-oriented downstream tooling.

Core Workflow

GraphQOMB is organized around three explicit compiler interfaces:

  • Labelled graph state: the resource state, measurement bases, and I/O registration.
  • Feedforward maps: explicit xflow and optional zflow describing classical dependencies.
  • Scheduler: preparation, entanglement, and measurement order for executable slices.

These are lowered with qompile(...) into a Pattern carrying:

  • a command stream for scheduled MBQC execution,
  • a PauliFrame for classical dependency tracking,
  • metrics such as max_space, depth, and active_volume.

Features

  • Explicit IR boundaries: work directly with graph-state, feedforward, and schedule objects instead of mixing them into a single representation.
  • Pattern lowering: compile MBQC IRs into executable patterns with TICK-delimited slices and Pauli-frame tracking.
  • Schedule analysis: compare depth-oriented and space-oriented schedules and inspect resulting resource metrics.
  • Simulation: run circuit or pattern simulations with statevector and density-matrix backends.
  • Stim export: compile compatible patterns to Stim text for downstream FT-oriented analysis.
  • Toolchain interoperability: use GraphQOMB downstream of circuit transpilation and graph-rewrite tooling such as PyZX and flow-finding utilities.

Installation

From PyPI

uv add graphqomb

Install optional PyZX integration:

uv add "graphqomb[pyzx]"

Install optional Stim integration:

uv add "graphqomb[stim]"

From Source

git clone https://github.com/UTokyo-FT-MBQC/graphqomb.git
cd graphqomb
uv sync

Install development dependencies:

uv sync --extra dev

Install documentation dependencies:

uv sync --extra doc

Quick Start

The quickest way to see the compiler pipeline is to start from an MBQC-native circuit, derive the graph/feedforward/schedule objects, and lower them into a pattern:

import numpy as np

from graphqomb.circuit import MBQCCircuit, circuit2graph
from graphqomb.qompiler import qompile
from graphqomb.simulator import PatternSimulator, SimulatorBackend

circuit = MBQCCircuit(3)
circuit.j(0, 0.5 * np.pi)
circuit.cz(0, 1)
circuit.cz(0, 2)
circuit.j(1, 0.75 * np.pi)
circuit.j(2, 0.25 * np.pi)

graphstate, xflow, scheduler = circuit2graph(circuit)
pattern = qompile(graphstate, xflow, scheduler=scheduler)

print("pattern depth:", pattern.depth)
print("pattern max space:", pattern.max_space)

simulator = PatternSimulator(pattern, SimulatorBackend.StateVector)
simulator.simulate()
print(simulator.state.state())

If you already have a graph-state design and explicit feedforward maps, you can skip circuit2graph(...) and call qompile(...) directly.

Documentation

Current Scope

GraphQOMB currently targets static, branch-free MBQC workflows. It is designed around causal feedforward dependencies and explicit scheduling, which makes it a good fit for pattern generation, simulation, and offline analysis of executable or fault-tolerant MBQC pipelines.

Development

Running Tests

uv run pytest
uv run pytest tests/test_specific.py

Code Quality

uv run ruff check
uv run ruff format
uv run mypy
uv run pyright

Building Documentation

cd docs
uv run sphinx-build -W source build

Contributing

Contributions are welcome. Please open an issue or pull request with:

  1. A clear description of the change.
  2. Tests for behavioral changes when applicable.
  3. Documentation updates for user-facing features.

Related Projects

  • graphix: MBQC software stack with a different abstraction strategy.
  • PyZX: ZX-calculus tooling that can be used upstream of GraphQOMB.
  • swiflow: Flow-finding utilities for MBQC dependency structures.
  • Stim: Fast stabilizer-circuit simulator targeted by the Stim export path.

Our ongoing projects

License

MIT 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/UTokyo-FT-MBQC/graphqomb}
}

Acknowledgements

We acknowledge the NICT Quantum Camp for supporting our development.

Special thanks to Fixstars Amplify:

amplify

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphqomb-0.5.0.tar.gz (195.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphqomb-0.5.0-py3-none-any.whl (135.2 kB view details)

Uploaded Python 3

File details

Details for the file graphqomb-0.5.0.tar.gz.

File metadata

  • Download URL: graphqomb-0.5.0.tar.gz
  • Upload date:
  • Size: 195.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for graphqomb-0.5.0.tar.gz
Algorithm Hash digest
SHA256 3aa875a76f2eb11978cac5cc091ab63d63ff546955f85b9e35b9b151572e897c
MD5 3447854e36247bf3b899d322f2846d81
BLAKE2b-256 08a0a7af5b215535d9632d413c346077866c1dfc5cee5e25f25f3987832b1f2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphqomb-0.5.0.tar.gz:

Publisher: publish-to-pypi.yml on UTokyo-FT-MBQC/graphqomb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graphqomb-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: graphqomb-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 135.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for graphqomb-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f1a7b6a0ae2753a3b07c7ae083467ebe6da91f012ef001d4e3b6add3b543c17
MD5 49a9d44cf04174fe2c407da07277e3fe
BLAKE2b-256 5d74a0fb763673f2e3b3cfb8756777390ec79980a971cdc758027b3f74eb01ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphqomb-0.5.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on UTokyo-FT-MBQC/graphqomb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

This release

0.5.0 This release

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page