TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
55 stars 20 forks source link

Flow and Gflow Checker #99

Closed masa10-f closed 5 months ago

masa10-f commented 7 months ago

Describe the feature you'd like

A function that determines whether a given (g)flow is a correct (g)flow or not based on the definition.

Additional context Add any other context or screenshots about the feature request here.

It can be useful for a graph-based generator and ZX-calculus-based backend, which will be introduced in the future.

pafloxy commented 7 months ago

Hello! it seems a good idea :) how do you plan to proceed about it ? I think it can be most conveniently checked by building two matrices one for the Gflow (say $\mathtt{F}$ ) and another for the odd neighbourhood of Glfow (say $\mathtt{O} \ : \ (\mathtt{A}_G \ \mathtt{F}^T)^T$ , where $\mathtt{A}_G$ is the adjacency matrix ) and then simply ensuring that those matrices are lower-triangular. Depending on the measurement plane we might need to check the diagonal elements as well but that won't add up to any further complicacies. I can put in more details about the calculation involved if you want, let me know what you think ;) PS: The linear algebra must be in $GF2$

Also what do you mean by a 'graph-based generator' ?

masa10-f commented 7 months ago

Thanks for your comment and sorry for the late reply. I understand your idea. I didn't think much about the implementation when I made this issue. Your proposal seems good, so I plan to follow it for implementation. Once I've pushed the changes, would you review my implementation?

Also what do you mean by a 'graph-based generator' ?

The graph-based generator here indicates graphix.generator.generate_from_graph that generates a pattern from a graph with measurement planes.

pafloxy commented 7 months ago

Sure! I will be glad to help ;)