Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Added new graph decoder and visualization tools for error and decoded graphs #585

Open
wants to merge 36 commits into
base: master
Choose a base branch
from

Conversation

Rahps97
Copy link

@Rahps97 Rahps97 commented Jul 10, 2021

Summary

Added a graph decoder that uses clustering and max_matching, defined as cluster_decoding.
It can be accessed similarly to matching. Change the algorithm = 'matching' to algorithm = 'clustering' to use it.
Draw 3d and 2d error graph method added. Ex:
For 2D:
from qiskit.ignis.verification.topological_codes import RepetitionCode
from qiskit.ignis.verification.topological_codes import GraphDecoder
from qiskit.ignis.verification.topological_codes import GraphVisualization

code = RepetitionCode(3,1)
Graph = GraphDecoder(code)
Error_Graph = Graph.make_error_graph('1 0 00 10 00')['0']
GraphVisualization().draw_2d_error_graph(Error_Graph)

For 3D:
code = RepetitionCode(3,1)
Graph = GraphDecoder(code)
Error_Graph = Graph.make_error_graph('1 0 00 10 00')['0']
GraphVisualization().draw_3d_error_graph(Error_Graph)

Function for 3d and 2d decoded graph also added. Ex:

For 2D:
code = RepetitionCode(3,1)
Graph = GraphDecoder(code)
Error_Graph = Graph.make_error_graph('1 0 00 10 00')['0']
[logical, Edgelist, nodelist]=Graph.cluster_decoding('1 0 00 10 00')
GraphVisualization.draw_2d_decoded_graph(Error_Graph,Edgelist,nodelist)

For 3D:
code = RepetitionCode(3,1)
Graph = GraphDecoder(code)
Error_Graph = Graph.make_error_graph('1 0 00 10 00')['0']
[logical, Edgelist, nodelist]=Graph.cluster_decoding('1 0 00 10 00')
GraphVisualization.draw_3d_decoded_graph(Error_Graph,Edgelist,nodelist)

Details and comments

This decoder used DBSCAN for clustering and then does matching if in a cluster there is an odd number of nodes, it merges the cluster with nearest cluster and matches again, until all the clusters have even nodes
Visualization command uses pyvista(https://docs.pyvista.org/index.html), retworkx and matplotlib for plotting.

Rahul Pratap Singh added 2 commits July 10, 2021 04:13
Added another graph decoding method
and  some graph drawing tools for 3d and 2d visualization of error graphs and decoded graphs.
@CLAassistant
Copy link

CLAassistant commented Jul 10, 2021

CLA assistant check
All committers have signed the CLA.

@Rahps97 Rahps97 changed the base branch from stable/0.3 to master July 10, 2021 01:40
Copy link
Collaborator

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I've only done a quick scan through the code, but not an in depth review yet. There are some inline comments from this, mostly around requirements files and unecessary changes. I also expect there will be a lot of CI failures from lint on this when I turn enable it (github doesn't run CI for first time contributors for security).

That all being said I feel like this really needs to be 2 separate pull requests. One adding the clustering feature to the graph decoder and the other adding the visualization techniques. They're really 2 logical additions that are independent of each other and have different concerns. Besides making it easier to review to it'll also make the code easier for people to consume from the git log because they're not being artificially bundled together in a single commit.

I'll enable the CI on this PR just so you can see where things are failing, but I think this will need to be split into 2 separate PRs before it's ready to merge.

constraints.txt Outdated Show resolved Hide resolved
docs/Makefile Outdated Show resolved Hide resolved
docs/release_notes.rst Outdated Show resolved Hide resolved
qiskit/ignis/verification/topological_codes/fitters.py Outdated Show resolved Hide resolved
qiskit/ignis/verification/topological_codes/fitters.py Outdated Show resolved Hide resolved
qiskit/ignis/verification/topological_codes/fitters.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@Rahps97
Copy link
Author

Rahps97 commented Jul 14, 2021

Thanks @mtreinish, I am on it. I will make all the mentioned changes.

Rahul Pratap Singh and others added 2 commits July 15, 2021 01:20
@Rahps97
Copy link
Author

Rahps97 commented Jul 24, 2021

@mtreinish made the changes and also created another class in qiskit\ignis\verification\topological_codes as GraphVisualization.
cluster_decoder is still in GraphDecoder.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants