iqm.qrisp_iqm.passes.routing.core.graph_processing_tools.gen_swap_candidates#
- iqm.qrisp_iqm.passes.routing.core.graph_processing_tools.gen_swap_candidates(instruction_data: ndarray, front_layer_indices: ndarray, topology: QPUTopology, c2a: ndarray, a2c: ndarray) list[tuple[int, int]]#
Generate deduplicated swap candidates for the front layer.
Returns all swaps that involve a qubit from an instruction in the front layer. This corresponds to all swaps that involve a qubit that is part of an instruction of the front layer.
Deduplication is performed via a boolean seen-matrix, normalizing each swap to (min, max) citizen indices before appending. This avoids scoring the same physical swap multiple times.
- Parameters:
instruction_data (ndarray) – The instruction data indicating which instructions are globally available.
front_layer_indices (ndarray) – Indices indicating which entries of
instruction_dataconstitute the front layer.topology (QPUTopology) – QPU topology.
c2a (ndarray) – A “citizan to address” array indicating the current layout.
a2c (ndarray) – An “address to citizen” array indicating the current layout.
- Returns:
Potentially viable swaps (deduplicated).
- Return type: