-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Open graph class #191
Add Open graph class #191
Conversation
This is based on the Open Graph definition from the "Picturing Quantum Software" textbook. Comes with methods to convert to and from pyzx diagrams. Provides properties inputs(), outputs(), and measurements() that are compatible with the rest of graphix.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #191 +/- ##
==========================================
+ Coverage 75.52% 75.89% +0.37%
==========================================
Files 34 36 +2
Lines 5569 5713 +144
==========================================
+ Hits 4206 4336 +130
- Misses 1363 1377 +14 ☔ View full report in Codecov by Sentry. |
60353a7
to
ac74914
Compare
Hi @EarlMilktea , thanks for your review! Could you have a look at my responses please? |
thanks for the PR @wlcsm ! Just to understand the direction:
|
My pleasure :)
Yes
I don't think this necessary in the open graph -> ZX or ZX -> open graph code. A ZX graph does not require flow. If you want to convert it to a ZX circuit (not a graph) then you will likely use the |
yes if it's graph <> ZX, there's no flow involved. Once we involve patterns, we need to care about flows, and what type (flow/gflow/pailiflow, max-delayed, focused, other). This is what @masa10-f has worked on, which is perhaps something we can incorporate later as a feature-rich transpilation between open graph and pattern (to be in separate PR). separate from above, do we want to implement OpenGraph.to_pattern to wrap |
also - @EarlMilktea @thierry-martinez do you think we should keep these qasm files? |
I personally don't prefer to include |
Are you saying that you wish to attach information about the flow to the Open Graph? I'm not familiar with the use case here so perhaps we can coordinate more with @masa10-f later on as it definitely sounds like something we can incorporate.
Sure. I can add a |
I understand that it looks like an unnecessary step to hold qasm files when we are testing the PyZX graphs --- with the code the way it is now, it would be more ideal to replace the qasm with code that directly constructs the graph in the unit test. The main reason I have included qasm is so that we can in future create tests to verify the correctness of the PyZX -> OpenGraph -> Pattern pipeline by for instance running the QASM and the resulting pattern on simulators and comparing the resulting tensors. If we directly construct the graphs using code instead, then we can't run it on an alternative simulator to compare the results. Regarding seperating PyZX from the code. I agree that this could be a good decision so that people can use the interface and not have to install PyZX if they don't need it. @EarlMilktea @shinich1 Would it then be better to move the
|
Hi @shinich1 , thanks for proactively implementing the change! Your change is great implementing the randomised circuit testing is great. I changed a couple of lines to ensure the pyzx dependency is optional and removed the QASM files. So now I think it is all ready to go |
@wlcsm Could you resolve my suggestions please? |
Hey @EarlMilktea, which suggestions are referring to? I can't see any unresolved suggestions |
It might be collapsed like this: |
@EarlMilktea When I click to see which changes you have requested here
I've expanded the discussions and I still can't find any unresolved changes 😅 |
I forgot to request changes after adding comments! 😭 |
Co-authored-by: S.S. <[email protected]>
@EarlMilktea No worries 😄 We are now using randomised circuits for testing and removed the QASM circuits, so the changes were naturally resolved. I've resolved your changes except one, please have a look at my reply |
Authored by thierry-martinez
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.
Looks good!
Only one simple suggestion.
Sorry I was checking outdated codes...
@wlcsm please squash and merge! |
will bump pypi version soon. |
Context: Many researchers in MBQC use a graphical approach to reasoning about patterns. These center around the concept of a open graph which can be thought of as a graphical description of an MBQC pattern with inputs and outputs
Description of the change: Added the Open graph class together with functionality for converting to and from pyzx diagrams.