-
Notifications
You must be signed in to change notification settings - Fork 160
Added new graph decoder and visualization tools for error and decoded graphs #585
base: master
Are you sure you want to change the base?
Conversation
Added another graph decoding method and some graph drawing tools for 3d and 2d visualization of error graphs and decoded graphs.
There was a problem hiding this 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.
releasenotes/notes/new-graph-decoder-and-visulization-method-e0e2a0792344a3b3.yaml
Outdated
Show resolved
Hide resolved
Thanks @mtreinish, I am on it. I will make all the mentioned changes. |
…0e2a0792344a3b3.yaml Co-authored-by: Matthew Treinish <[email protected]>
Removed test for cluster decoding
This reverts commit d1922e3.
@mtreinish made the changes and also created another class in |
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.