|View source on GitHub|
Whether a given order of operations is consistent with the DAG.
cirq.contrib.acquaintance.is_topologically_sorted( dag: "cirq.CircuitDag", operations: "cirq.OP_TREE", equals: Callable[[
cirq.ops.Operation], bool] = operator.eq ) -> bool
For example, suppose the (transitive reduction of the) circuit DAG is
╭─> Op2 ─╮
Op1 ─┤ ├─> Op4 ╰─> Op3 ─╯
Then [Op1, Op2, Op3, Op4] and Op1, Op3, Op2, Op4 are topologically sorted according to the DAG, and any other ordering of the four operations is not.
Evaluates to False when the set of operations is different from those in the nodes of the DAG, regardless of the ordering.
||The circuit DAG.|
||The ordered operations.|
The function to determine equality of operations. Defaults to
|Whether or not the operations given are topologically sorted according to the DAG.|