View source on GitHub |
A representation of a Circuit as a directed acyclic graph.
Nodes of the graph are instances of Unique containing each operation of a circuit.
Edges of the graph are tuples of nodes. Each edge specifies a required application order between two operations. The first must be applied before the second.
The graph is maximalist (transitive completion).
Methods
all_operations
all_operations() -> Iterator['cirq.Operation']
all_qubits
all_qubits()
append
append(
op: 'cirq.Operation'
) -> None
disjoint_qubits
disjoint_qubits(
op1: 'cirq.Operation', op2: 'cirq.Operation'
) -> bool
Returns true only if the operations have qubits in common.
findall_nodes_until_blocked
findall_nodes_until_blocked(
is_blocker: Callable[['cirq.Operation'], bool]
) -> Iterator[Unique['cirq.Operation']]
Finds all nodes before blocking ones.
Args | |
---|---|
is_blocker
|
The predicate that indicates whether or not an operation is blocking. |
from_circuit
@staticmethod
from_circuit( circuit:
cirq.Circuit
, can_reorder: Callable[['cirq.Operation', 'cirq.Operation'], bool] =cirq.contrib.CircuitDag.disjoint_qubits
) -> 'CircuitDag'
from_ops
@staticmethod
from_ops( *operations, can_reorder: Callable[['cirq.Operation', 'cirq.Operation'], bool] =
cirq.contrib.CircuitDag.disjoint_qubits
) -> 'CircuitDag'
make_node
@staticmethod
make_node( op: 'cirq.Operation' ) ->
cirq.contrib.Unique
ordered_nodes
ordered_nodes() -> Iterator[Unique['cirq.Operation']]
to_circuit
to_circuit() -> cirq.Circuit
__eq__
__eq__(
other
)
Return self==value.
__ne__
__ne__(
other
)
Return self!=value.