def METHOD_NAME():
    q0, q1, q2, q3 = [
        cirq.GridQubit(0, 5),
        cirq.GridQubit(1, 5),
        cirq.GridQubit(2, 5),
        cirq.GridQubit(3, 5),
    ]
    # This circuit does not have CZ gates on adjacent qubits because the order
    # dag.to_circuit() would append them is non-deterministic.
    circuit = cirq.Circuit(
        cirq.X(q0),
        cirq.CZ(q1, q2),
        cirq.CZ(q0, q1),
        cirq.Y(q0),
        cirq.Z(q0),
        cirq.CZ(q1, q2),
        cirq.X(q0),
        cirq.Y(q0),
        cirq.CZ(q0, q1),
        cirq.T(q3),
        strategy=cirq.InsertStrategy.EARLIEST,
    )
    dag = cirq.contrib.CircuitDag.from_circuit(circuit)
    assert networkx.dag.is_directed_acyclic_graph(dag)
    # Operation order within a moment is non-deterministic
    # but text diagrams still look the same.
    desired = """