Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.4%) to scientific vocabulary
Repository
Quantum Three-Coloring Graphs Iteritavely
Basic Info
Statistics
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
QT-CorGI:
Quantum Three-Coloring Graphs Iteritavely
Quantum Three-Coloring Graphs Iteritavely: Repository contains open source code for comparing qutrits against qubits for solving graph three-colouring using the Quantum Approximate Optimization Algorithm (QAOA).
Example qutrit circuit composition
```python import pennylane as qml import qtcorgi import networkx as nx
edgelist = [[0,1]] # Edge list using numbered nodes graph = nx.Graph(edgelist) qutrit_solver = qtcorgi.QutritQaoa(graph)
@qml.qnode(qml.device("default.qutrit", 2))
def circuit(gamma, beta):
qutritsolver.unitarycircuit([gamma],[beta],1)
return qml.expval(qml.GellMann(0,3))
pycon
qml.draw(circuit)(1,2) 0: ──TH─╭●───────────────────────────╭●─────TRX(2.00)──TRX(2.00)──TRX(2.00)─┤
1: ──TH─╰TAdd†──TRZ(1.33)──TRZ(1.33)─╰TAdd──TRX(2.00)──TRX(2.00)──TRX(2.00)─┤
```
Overview
This project consists of two packages described bellow:
1. qaoa3colouring:
qaoa3colouring acts as a graph 3-colouring solver using either qubit and qutrit based QAOA.
qaoa3colouring also allows for comparison by entering data into plot builders.
2. experiments:
experiments allows a user to recreate the data and figures used in IEEE submission. It also allows for users to update hyper-parameters and sets of graphs that are considered.
This will be updated to include all future paper submissions.
Solving graphs (qaoa3colouring package)
To solve a graph using the qaoa3colouring package users will create a QuditQaoa object for each graph that the user plans to solve. The user will then call QuditQaoa.qaoa3colouring() method to solve the graph.
The QuditQaoa object will either be from the QubitQaoa or QutritQaoa class. This selection determines if a simulation using qubits or qutrits will be used.
Currently, NumberOfGates and ProbabilityCorrectSampled classes can be used to make figures based on saved data.
Qutrit QAOA example
python
import networkx as nx
import qtcorgi
edge_list = [[0,1], [1,2], [2,0]] # Edge list using numbered nodes
graph = nx.Graph(edge_list)
qutrit_solver = qtcorgi.QutritQaoa(graph, samples=10)
solution_values = qutrit_solver.qaoa_3_colouring()
```pycon
print("Final objective value:", solutionvalues[0]) Final objective value: -1.977612038050443 print("Sampledsolutions as ints:", solutionvalues[1]) Sampledsolutions as ints: [15 21 21 11 21 19 7 7 5 19] print("Trit-sting array:", solutionvalues[2]) Trit-sting array: [1 2 0][2 1 0][2 1 0][1 0 2][2 1 0][2 0 1][0 2 1][0 2 1][0 1 2][2 0 1] print("Most frequently sampled trit-stings:", solutionvalues[3]) Most frequently sampled trit-stings: 210 print("Input parameters:", solution_values[4]) Input parameters: [[ 0.3113133 0.396807 0.52144379] [-0.41018815 -0.14562269 -0.28965116]] ```
Repeating Experiments
To repeat a paper and change hyperparameters the experiments package can be used. By simply calling experiments.replicateIEEEpaper() the experiment will be repeated and the graphs will be saved. default configurations used for the IEEE paper are found in experiments/config_IEEE
Configuration parameters are listed and described bellow:
- save_location (str): location to save the data folder.
- savefoldername (str): data folder name.
- num_layers: number of QAOA layers used to differing graph sizes.
- numqutritsteps: maximal number of optimization steps for qutrits.
- numqubitsteps: maximal number of optimization steps for qubits.
- num_samples: number of samples taken for solution.
- learning_rate: optimization learning rate.
- fourthcolourcost: cost for fourth colour for qubit cost Hamiltonian.
- qubitconvergencevalue: convergence value for qubit optimization halting.
- graphstogenerate_dictionary: dictionary describing which graphs to generate and solve.
- nforlayers: number of nodes for graphs used to test variable number of layers.
- test_layers: list of number of layers being tested.
- optconnectivitylabels: labels for the connectivity of tested graphs.
- costconnectivitylabels: labels for the connectivity of graphs used for cost metrics.
- graphscountgates_dictionary: dictionary describing which graphs to generate and find circuit cost metrics.
- minqubitsteps: minimum number of optimization steps done for qubit optimization.
- fig_width: width of final figure.
- fig_height: height of final figure.
- figsavefolder: folder where figure is saved.
- useseparateparams_qubit: boolean deciding if the colouring cost parameter and the fourth colour cost parameter are seperated.
- connectivity_colours: list of colours used in figures.
- optbarwidth : width of bars on plotted graph.
- costbarwidth : width of bars on plotted graph.
Installation
The only supported OS for this repo is Linux
Currently, the Pennylane tested branch is missing some of the necessary features for this package to work.
To be able to run this branch it is necessary to install the dev branch which can be done using the following command:
commandline
pip install git+https://github.com/PennyLaneAI/pennylane.git
To run this branch it is also necessary to install JAX, it is recommended to use GPU acceleration.
This requires an nvidia graphics card with updated nvidia drivers installed.
It also requires CUDA, which can be difficult to install.
Detailed installation instructions for JAX and CUDA can be found at JAX's GitHub page.
However, if CUDA is not previously installed it is recommended to install both using the following commands:
```commandline
pip install --upgrade pip
CUDA 12 installation
pip install --upgrade "jax[cuda12pip]" -f https://storage.googleapis.com/jax-releases/jaxcudareleases.html ``` If your GPU doesn't support CUDA 12 replace "cuda12pip" with "cuda11_pip".
Finally installing the project can be done by the following command:
commandline
pip install -e /PATH/TO/REPO
Owner
- Name: QSAR Group
- Login: QSAR-UBC
- Kind: organization
- Location: Canada
- Website: glassnotes.github.io/qsar.html
- Repositories: 1
- Profile: https://github.com/QSAR-UBC
Quantum software and algorithms research at UBC
Citation (CITATION.cff)
cff-version: 1.0.0 message: "If you use this software, please cite it as below." authors: - family-names: "Bottrill" given-names: "Gabriel" title: "QT-CorGI: Quantum Three-coloring Graph Iteritavely" version: 0.1.0 date-released: 2023-07-31 url: "https://github.com/QSAR-UBC/QT-CorGI"