Code accompanying the paper "On the Distortion of Partitioning Performance by Random Quantum Circuits"
This repository contains the partitioning pipeline, analysis scripts, and statistical tests used to evaluate how well different hypergraph partitioning strategies distribute quantum circuits across multi-QPU networks — and whether the choice of strategy matters more for real circuits than for random or procedurally generated ones.
Note this README was generated by Claude
| File | Description |
|---|---|
| main.py | Partitioning pipeline — reads .qasm circuits, maps them to hypergraphs, and runs a partitioning strategy across QPU counts k = 2…10 |
| analysis.py | Generates all paper figures (violin plots, heatmaps, scatter plots, normalised-cut lines) from partitioning_results.csv |
| mannwhitney_test.py | Pairwise Mann-Whitney U tests comparing cost distributions across circuit origin categories |
| twoqubit_density.py | Computes two-qubit gate density per circuit origin |
| zoltan_phg_partition.c | C subprocess wrapper for Zoltan's Parallel HyperGraph (PHG) partitioner |
| partitioning_results.csv | Pre-computed partitioning results used in the paper |
Circuits are placed in ./Circuits/ following the naming convention:
monolithic__{origin}__{identifier}__{n_qubits}.qasm
The five circuit origins studied are:
| Origin tag | Category | Description |
|---|---|---|
mqt |
Real | MQT Bench application circuits |
quipper |
Real | Quipper library circuits |
randomqiskit |
Random | Randomly generated circuits via Qiskit |
randomfromgraphqiskit |
Random | Random circuits sampled from random graphs via Qiskit |
qgen |
Generated | Procedurally generated circuits (QGen) |
Quantum circuits are modelled as hypergraphs:
- Vertices = qubits
- Hyperedges = multi-qubit gates (single-qubit gates are ignored)
Communication cost = number of cut hyperedges (gates whose qubits span more than one QPU).
The pipeline partitions circuits for every valid k in {2, …, 10} subject to a minimum of 5 qubits per QPU.
The following strategies are implemented in main.py (some are commented out and can be swapped in):
| Strategy | Key | Notes |
|---|---|---|
| StocG (active) | StocG |
Randomised iterated greedy with local improvement and a wall-clock cap |
| Zoltan PHG | zoltan_phg |
Zoltan's Parallel HyperGraph partitioner via C subprocess |
| Greedy | greedy |
Single-pass plurality greedy |
| FM | fm |
k-way Fiduccia-Mattheyses iterative improvement |
| EA | ea |
Evolutionary / genetic algorithm |
| Random | random |
Uniform random assignment (baseline) |
| KaHyPar | kahypar_default |
KaHyPar (requires separate install) |
All improvements in the analysis are measured relative to the random baseline:
improvement (%) = (random_cut − strategy_cut) / max(random_cut, 1) × 100
Requirements: Python 3.10+, plus the packages listed below.
python -m venv venv
source venv/bin/activate # or venv/bin/activate.fish
pip install qiskit tqdm numpy pandas matplotlib scipyTo compile the Zoltan PHG wrapper (requires Zoltan and MPI headers):
# Example — adjust include/lib paths for your system
mpicc zoltan_phg_partition.c -o zoltan_phg_partition \
-I/path/to/zoltan/include -L/path/to/zoltan/lib -lzoltan -lmRun the partitioning pipeline (appends to partitioning_results.csv, resumes automatically if interrupted):
python main.pyGenerate figures (saved as SVG to ./analysis_figures/):
python analysis.pyRun statistical tests:
python mannwhitney_test.py
python twoqubit_density.pypartitioning_results.csv columns:
| Column | Description |
|---|---|
partitioning_strategy |
Strategy name |
circuit_partitioned |
Circuit filename stem |
origin_of_circuit |
Origin tag (e.g. mqt, randomqiskit) |
circuit_identifier |
Algorithm/benchmark name |
n_qubits_circuit |
Number of qubits |
n_qpus |
Number of QPUs (k) |
coms_cost |
Cut hyperedges (communication cost) |
If you use this code or data, please cite the accompanying paper:
@inproceedings{grageragarces2026distortion,
title = {On the Distortion of Partitioning Performance by Random Quantum Circuits},
author = {Gragera Garces, Maria},
booktitle = {Proceedings of the Workshop on Distributed Quantum Information and Computing (DisQIC)
at the 46th IEEE International Conference on Distributed Computing Systems (ICDCS 2026)},
year = {2026},
month = {June},
address = {Seoul, South Korea},
}