cirq.Circuit.next_moment_operating_on

Circuit.next_moment_operating_on(qubits: Iterable[cirq.ops.raw_types.Qid], start_moment_index: int = 0, max_distance: int = None) → Optional[int][source]

Finds the index of the next moment that touches the given qubits.

Parameters:
  • qubits – We’re looking for operations affecting any of these qubits.
  • start_moment_index – The starting point of the search.
  • max_distance – The number of moments (starting from the start index and moving forward) to check. Defaults to no limit.
Returns:

None if there is no matching moment, otherwise the index of the earliest matching moment.

Raises:

ValueError – negative max_distance.