Skip to content
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

Improve testing of Open graph to pattern conversions #196

Open
wlcsm opened this issue Aug 5, 2024 · 2 comments
Open

Improve testing of Open graph to pattern conversions #196

wlcsm opened this issue Aug 5, 2024 · 2 comments
Labels
new feature New feature or request

Comments

@wlcsm
Copy link
Collaborator

wlcsm commented Aug 5, 2024

Currently we only test converting Open graphs to (OpenGraph.to_pattern()) and from (OpenGraph.from_pattern()) patterns with a couple of handcrafted examples in tests/test_opengraph.py.

It would instead be more robust to test these methods on many randomly generated graphs and patterns (by modifying random_objects.py with random open graph generation), and check the results against a simulator.

@wlcsm wlcsm added the new feature New feature or request label Aug 5, 2024
@pafloxy
Copy link

pafloxy commented Aug 5, 2024

How are you planning to generate the open-graphs ?

@wlcsm
Copy link
Collaborator Author

wlcsm commented Aug 6, 2024

Great question. I do not know. Open graphs need four items, a graph, measurements for non-output nodes, inputs and outputs. All of these could be randomised however it is very likely the resulting open graph would not have flow.

We could simply repeat the procedure enough times, checking each time whether the open graph has flow and then stop when we find one. It is not very efficient but it is simple.

Another way would be to randomly generate circuits in PyZX, then convert those to a graph using PyZX's in-built to_graph method and then convert these to open graphs via the OpenGraph.from_pyzx_graph method. This has the advantage of always generating an OpenGraph with flow, but the problem is that we create a reliance on the PyZX module which is supposed to be optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants