TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
55 stars 20 forks source link
graph-states mbqc quantum quantum-computing quantum-programming-language unitaryhack
logo

PyPI - Python Version PyPI Unitary Fund DOI Documentation Status GitHub Downloads Code style: black

Graphix is a measurement-based quantum computing (MBQC) software package, featuring

Installation

Install graphix with pip:

$ pip install graphix

Install together with device interface:

$ pip install graphix[extra]

this will install graphix and inteface for IBMQ and Perceval to run MBQC patterns on superconducting and optical QPUs and their simulators.

Using graphix

generating pattern from a circuit

from graphix import Circuit
circuit = Circuit(4)
circuit.h(0)
...
pattern = circuit.transpile()
pattern.draw_graph()
logo

note: this graph is generated from QAOA circuit, see our example code. Arrows indicate the causal flow 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

pattern.perform_pauli_measurements()
pattern.draw_graph()
logo

(here, the graph is visualized based on generalized flow.)

simulating the pattern

state_out = pattern.simulate_pattern(backend='statevector')

and more..

Citing

Shinichi Sunami and Masato Fukushima, Graphix. (2023) https://doi.org/10.5281/zenodo.7861382