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

[Bug]: minimize_space breaks runnability for patterns that are inconsistent with their graph flow #157

Open
thierry-martinez opened this issue May 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@thierry-martinez
Copy link
Contributor

Describe the bug
If a pattern has a graph with a flow but is not consistent with this flow, minimize_space leads to a pattern with is not runnable anymore.

To Reproduce

import graphix
pattern = graphix.pattern.Pattern(input_nodes=[0])
pattern.add(["N", 1])
pattern.add(["N", 2])
pattern.add(["E", (0, 1)])
pattern.add(["E", (1, 2)])
pattern.add(["M", 1, "XY", 0, [], []])
pattern.add(["M", 0, "XY", 0, [1], []])
pattern.add(["Z", 2, [0]])
pattern.simulate_pattern() # OK
pattern.minimize_space()
pattern.simulate_pattern() # KeyError: 1

Expected behavior
minimize_space should preserve pattern runnability.

@thierry-martinez thierry-martinez added the bug Something isn't working label May 27, 2024
@masa10-f
Copy link
Contributor

Is it emergency to support non-deterministic pattern? We can resolve this bug by removing get_measurement_order_from_flow but I'm not really willing to remove it because there's a performance drawback(@nabe98 is tackling the performance issue but it will take more time).

For temporal solution, we can patch this by adding a new option to use flow based minimizing or not. Do you agree with this?

@mgarnier59
Copy link
Contributor

It is not an emergency but it is a common issue in Graphix. We need to know if the pattern is consistent with a gflow before applying some operations. If it turns out not to be the case then problems arise.

I think @shinich1 had an example.
I planned on diving into what exactly happens in the graphical version of Elliott et al. but since you know that better than I do, might be a good idea. Another topic we can adress in July!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants