I have the following code, which runs properly.
from qiskit import *
from qiskit.converters import *
ghz2 = QuantumCircuit(5, 5)
ghz2.h(2)
ghz2.cx(2, 1)
ghz2.cx(1, 0)
ghz2.cx(2, 3)
ghz2.cx(3, 4)
ghz_dag = circuit_to_dag(ghz2)
How do I access properties of this dag? For instance, I would like to get all the 2-qubit gates using the collect 2qubit gates method (the output is supposed to be a dictionary) or simply draw the DAG but again, dag_drawer(ghz_dag) throws up an error ('MultiDiGraph' object has no attribute 'number_of_selfloops'
) even though, that's done in an example here.
Maybe this is just a Python usage question but how does one access the properties of the DAG?