You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may be related to #10; at least the symptom sounds the same.
Running the sequence of commands in the "Getting Started" document leads (usually) to an error after running Circuit.from_graph after clifford_simp, with the message "Graph doesn't seem circuit like: multiple parents".
A simple example that demonstrates the issue is:
def bad_graph():
g = zx.Graph()
g.add_vertices(8)
g.set_type(2,1)
g.set_type(3,1)
g.set_type(4,2)
g.set_type(5,1)
g.set_position(0,0,0)
g.set_position(1,1,0)
g.set_position(2,0,1)
g.set_position(3,1,1)
g.set_position(4,0,2)
g.set_position(5,1,2)
g.set_position(6,0,3)
g.set_position(7,1,3)
g.add_edges([(0,2),(2,4),(4,6),(1,3),(3,5),(5,7),(4,5)])
g.inputs.extend([0,1])
g.outputs.extend([6,7])
return g
g = bad_graph()
zx.simplify.clifford_simp(g)
Circuit.from_graph(g)
In fact, just doing spider_simp (the first step in clifford_simp) is enough to cause the error.
The problem is that the two green spiders on qubit 1 get merged to a position to the left of the (previously) red spider to which they remain connected.
I am not sure what the actual bug is or even if this is supposed to work -- but in any case the example code is not working.
The text was updated successfully, but these errors were encountered:
Hi, Thanks for the report. Circuit.from_graph does nothing fancy and hence only works if the ZX diagram already looks like a circuit. The line you are referring to in the getting started document: c = zx.Circuit.from_graph(g) is a typo and should have read: c = zx.Circuit.from_graph(c)
which would have made sense in a previous version of PyZX where the extraction returned a circuit-like graph instead of a Circuit. I've updated the getting started document to reflect the change in PyZX.
This may be related to #10; at least the symptom sounds the same.
Running the sequence of commands in the "Getting Started" document leads (usually) to an error after running
Circuit.from_graph
afterclifford_simp
, with the message "Graph doesn't seem circuit like: multiple parents".A simple example that demonstrates the issue is:
In fact, just doing
spider_simp
(the first step inclifford_simp
) is enough to cause the error.The problem is that the two green spiders on qubit 1 get merged to a position to the left of the (previously) red spider to which they remain connected.
I am not sure what the actual bug is or even if this is supposed to work -- but in any case the example code is not working.
The text was updated successfully, but these errors were encountered: