# cirq.contrib.acquaintance.is_topologically_sorted

Whether a given order of operations is consistent with the DAG.

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.

`dag` The circuit DAG.
`operations` The ordered operations.
`equals` The function to determine equality of operations. Defaults to `operator.eq`.

Whether or not the operations given are topologically sorted according to the DAG.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]
{"lastModified": "Last updated 2024-06-27 UTC."}