This repository includes the
In the benchmark_data folder, you'll find a total of G{D}#{N}_{I}.csv
, where
The file structure of each G{D}#{N}_{I}.csv
file are as follows:
- The first line contains four comma separated values. They are
-
$N$ - The number of vertices in the graph. -
$M$ - The number of edges in the graph. -
$C_{opt}$ - The cost of the optimal cut of the graph. - MIPGap - The gap between the lower and upper objective bound divided by the absolute value of the incumbent objective value. A MIPGap of
$0.0$ indicates that the solution is optimal.
-
- The second line contains the assignments that give the optimal cut
$C_{opt}$ . The$\pm 1$ value at index$i$ corresponds to the value assigned to the node$i$ for the nodes in the range$0, \dots, N-1$ . - The lines
$3$ till$M+2$ contain the edges that generate the$D$ -regular graph.
The following Python code allows to reads the G{D}#{N}_{I}.csv
and returns the graph attributes along with the list of edges. The edge list can be used to construct the
import csv
def read_graph(D, N, I):
edges = []
with open(f"benchmark_data/G{D}#{N}_{I}.csv") as graph_file:
graph_reader = csv.reader(graph_file, delimiter=',')
for i, row in enumerate(graph_reader):
if i == 0:
_, M, C_opt, MIPGap = row
elif i == 1:
solution = row
else:
i, j = row
edges.append((int(i), int(j)))
solution = [int(x) for x in solution]
graph_attr = {"Nodes": N, "Edges": int(M), "Cost": float(C_opt),
"MIPGap": float(MIPGap), "Solution": solution}
return graph_attr, edges
The data collected in the numerical simulations are located in the simulation_data folder. They too are present in a machine-readable CSV format, however, these CSV files are also readable by the Python Pandas library (Pandas can read these CSV files as a DataFrame object.) The CSV file names follow the same convention as those in benchmark_data folder, G{D}#{N}_{I}.csv
, where
The CSV files present in the root of the simulation_data folder contain the numerical simulation results of benchmarking the
contain the numerical data for the G3#128_{I}.csv
graphs.
The CSV files present in simulation_data/FIG5_Dataset and simulation_data/FIG7_Dataset contain the data to generate the plots in Figures 5 and 7 of the paper. Please note that these CSV files (with the exception of simulation_data/FIG7_Dataset) are not readable by the Pandas as a DataFrame object.
For usage of these simulation data, please refer the python scripts present in the plot_scripts folder.
The mwe folder contains the minimal working example implemented in Python for classically simulating the XQAOA ansatz on the MaxCut problem. The minimal working example consists of three files
- Graph.py - This script stores a graph along with its relevant attributes in a datastructure that is most suited to the needs of the XQAOA ansatz.
- XQAOA.py - This scripts contains the XQAOA class that allows for classical simulation of the XQAOA ansatz for the MaxCut problem.
-
Example.ipynb - A Jupyter Notebook that contains an example for classically simulating the XQAOA ansatz and its variants on a simple
$3$ -regular graph.
Please consider citing this repository and our paper An Expressive Ansatz for Low-Depth Quantum Optimization if you find this repository useful and use it in your research for benchmarking purposes.