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

CNOT Benchmark demo broken: TypeError: Graph doesn't seem circuit like: multiple parents #10

Closed
balopat opened this issue Apr 6, 2019 · 0 comments

Comments

@balopat
Copy link
Contributor

balopat commented Apr 6, 2019

Running the CNOT Benchmark example under demos fails with

Circuit              qubits G-count 2-count G-NRSCM 2-NRSCM  G-Tpar 2-Tpar G-PyZX 2-PyZX Time-Simp Time-Opt
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-fa5aee888fdf> in <module>
      1 print("Circuit".ljust(20), "qubits", "G-count", "2-count", "G-NRSCM", "2-NRSCM", " G-Tpar", "2-Tpar", "G-PyZX", "2-PyZX", "Time-Simp", "Time-Opt")
      2 for c in fast_circuits:
----> 3     print(c.get_output())

<ipython-input-14-eb2f95ae4779> in get_output(self)
     54     def get_output(self):
     55         if not self.has_run:
---> 56             self.run()
     57         s = self.name.ljust(20) + str(self.qubits).rjust(7)
     58         s += " | " + str(self.gatecount).rjust(5) + str(self.cnotcount).rjust(6) + " | "

<ipython-input-14-eb2f95ae4779> in run(self)
     43         self.time_simpl = time.time() - t
     44         t = time.time()
---> 45         c = zx.Circuit.from_graph(g).split_phase_gates()
     46         c = zx.optimize.basic_optimization(c).to_basic_gates().split_phase_gates()
     47         self.circuit_opt = c

~/dev/proj/pyzx/pyzx/circuit.py in from_graph(g, split_phases)
     82                 neigh = [w for w in g.neighbours(v) if rs[w]<r]
     83                 if len(neigh) != 1:
---> 84                     raise TypeError("Graph doesn't seem circuit like: multiple parents")
     85                 n = neigh[0]
     86                 if qs[n] != q:

TypeError: Graph doesn't seem circuit like: multiple parents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant