https://github.com/teamgraphix/graphix
measurement-based quantum computing (MBQC) library
https://github.com/teamgraphix/graphix
graph-states mbqc quantum quantum-computing quantum-programming-language unitaryhack
Last synced: 1 day ago
JSON representation
measurement-based quantum computing (MBQC) library
- Host: GitHub
- URL: https://github.com/teamgraphix/graphix
- Owner: TeamGraphix
- License: apache-2.0
- Created: 2022-12-02T14:29:12.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2026-01-12T09:27:26.000Z (9 days ago)
- Last Synced: 2026-01-12T18:41:12.378Z (9 days ago)
- Topics: graph-states, mbqc, quantum, quantum-computing, quantum-programming-language, unitaryhack
- Language: Python
- Homepage: https://graphix.readthedocs.io
- Size: 2.45 MB
- Stars: 100
- Watchers: 3
- Forks: 41
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
Awesome Lists containing this project
README




[](https://pepy.tech/project/graphix)
[](https://unitary.foundation/)
[](https://zenodo.org/badge/latestdoi/573466585)
[](https://github.com/TeamGraphix/graphix/actions/workflows/ci.yml)
[](https://codecov.io/gh/TeamGraphix/graphix)
[](https://graphix.readthedocs.io/en/latest/?badge=latest)
[](https://github.com/astral-sh/ruff)
**Graphix** is a measurement-based quantum computing (MBQC) software package, featuring
- the measurement calculus framework with integrated graphical rewrite rules for Pauli measurement preprocessing
- circuit-to-pattern transpiler, graph-based deterministic pattern generator and manual pattern generation
- flow, gflow and pauliflow finding tools and graph visualization based on flows (see below)
- statevector, density matrix and tensornetwork pattern simulation backends
- QPU interface and fusion network extraction tool
- _new_: [efficient implementation of fast O(N^3) pauli-flow finding algorithm](https://github.com/TeamGraphix/graphix/pull/337)
## Installation
Install `graphix` with `pip`:
```bash
pip install graphix
```
Install together with [extra packages](https://github.com/TeamGraphix/graphix/blob/master/requirements-extra.txt):
```bash
pip install graphix[extra]
```
## Using graphix
### generating pattern from a circuit
```python
from graphix import Circuit
circuit = Circuit(4)
circuit.h(0)
...
pattern = circuit.transpile().pattern
pattern.standardize()
pattern.shift_signals()
pattern.draw_graph(flow_from_pattern=False)
```

See [our example code](examples/qaoa.py) to generate this pattern. Arrows indicate the [_causal flow_](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.74.052310) of MBQC and dashed lines are the other edges of the graph. the vertical dashed partitions and the labels 'l:n' below indicate the execution _layers_ or the order in the graph (measurements should happen from left to right, and nodes in the same layer can be measured simultaneously), based on the partial order associated with the (maximally-delayed) flow.
### preprocessing Pauli measurements (Clifford gates)
```python
pattern.perform_pauli_measurements()
pattern.draw_graph()
```

(here, the visualization is based on [_generalized flow_](https://iopscience.iop.org/article/10.1088/1367-2630/9/8/250)).
### simulating the pattern
```python
state_out = pattern.simulate_pattern(backend="statevector")
```
### and more..
- See [demos](https://graphix.readthedocs.io/en/latest/gallery/index.html) showing other features of `graphix`.
- Read the [tutorial](https://graphix.readthedocs.io/en/latest/tutorial.html) for more usage guides.
- For theoretical background, read our quick introduction into [MBQC](https://graphix.readthedocs.io/en/latest/intro.html) and [LC-MBQC](https://graphix.readthedocs.io/en/latest/lc-mbqc.html).
- Full API docs is [here](https://graphix.readthedocs.io/en/latest/references.html).
## Related packages
- [graphix-stim-backend](https://github.com/thierry-martinez/graphix-stim-backend): `stim` backend for efficient Clifford pattern simulation
- [graphix-symbolic](https://github.com/TeamGraphix/graphix-symbolic): parameterized patterns with symbolic simulation
- [graphix-ibmq](https://github.com/TeamGraphix/graphix-ibmq): pattern transpiler for IBMQ / `qiskit`
- [graphix-perceval](https://github.com/TeamGraphix/graphix-perceval): pattern transpiler for Quandela's `perceval` simulator and QPU
- [graphix-qasm-parser](https://github.com/TeamGraphix/graphix-qasm-parser): a plugin for parsing OpenQASM circuit.
- [swiflow](https://github.com/TeamGraphix/swiflow): rust-based implementation of flow-finding algorithms
### Projects using `graphix`
- [veriphix](https://github.com/qat-inria/veriphix): verified blind quantum computation and benchmarking.
- [optyx](https://github.com/quantinuum-dev/optyx): ZX-based software for networked quantum computing
- [graphqomb](https://github.com/TeamGraphix/graphqomb): modular graph state compiler for fault-tolerant MBQC and more.
## Citing
> Zenodo: https://doi.org/10.5281/zenodo.7861382
>
> arXiv: https://doi.org/10.48550/arXiv.2212.11975
## Contributing
We use [GitHub issues](https://github.com/TeamGraphix/graphix/issues) for tracking feature requests and bug reports.
## Discussion channels
- Our Slack channel, for regular discussions and questions: https://graphix-org.slack.com
- Please visit [Unitary Foundation's Discord server](https://discord.com/servers/unitary-foundation-764231928676089909), where you can find a channel for `graphix`.
## Maintainers (alphabetical order)
- Masato Fukushima (University of Tokyo, Fixstars Amplify)
- Maxime Garnier (Inria Paris)
- Emlyn Graham (Inria Paris)
- Thierry Martinez (Inria Paris)
- Pranav Nair (Inria Paris)
- Sora Shiratani (University of Tokyo, Fixstars Amplify)
- Shinichi Sunami (University of Oxford)
- Mateo Uldemolins (Inria Paris)
## Acknowledgements
Graphix was founded in 2022 by Shinichi Sunami (University of Oxford) and Masato Fukushima (University of Tokyo, Fixstars Amplify) with support from [Fixstars Amplify](https://amplify.fixstars.com/en/) and [Unitary Foundation](https://unitary.foundation/grants.html), and later joined by Daichi Sasaki, Yuki Watanabe and Sora Shiratani (University of Tokyo, Fixstars Amplify).
Since 2023, Graphix team is joined by Qode group of the [QAT](https://qat.inria.fr/presentation/) team, co-hosted by [Inria](https://www.inria.fr/) and [ENS](https://www.ens.psl.eu/), who develops and maintains the library.
Special thanks also to [HQI](https://www.hqi.fr).
## License
[Apache License 2.0](LICENSE)