iqm.benchmarks.entanglement.ghz_optimal.generate_ghz_tree_optimal

iqm.benchmarks.entanglement.ghz_optimal.generate_ghz_tree_optimal#

iqm.benchmarks.entanglement.ghz_optimal.generate_ghz_tree_optimal(qubit_layout: Sequence[int], backend: IQMBackendBase, metrics: Mapping[str, Mapping[int | tuple[int, int], float]], num_qubits: int | None = None, tree_options: TreeSearchOptions | None = None, rank: int = 0) → tuple[IQMCircuit, list[int], TreeCandidate | None]#

Build a shallow GHZ circuit from one of the ranked trees over the layout.

Parameters:
  • qubit_layout (Sequence[int]) – The subset of system-qubits used in the protocol, indexed from 0.

  • backend (IQMBackendBase) – The backend whose coupling map defines the connectivity.

  • metrics (Mapping[str, Mapping[int | tuple[int, int], float]]) – The metrics dictionary from extract_fidelities_unified().

  • num_qubits (int | None) – Size of the GHZ state; None uses every qubit of the layout. When smaller than the layout, the tree search chooses which qubits to use.

  • tree_options (TreeSearchOptions | None) – What the tree search minimizes; defaults to TreeSearchOptions.

  • rank (int) – Which of the ranked candidates to build, 0 being the best-scoring one.

Returns:

The GHZ circuit (measured), the physical qubits in logical-qubit order, and the chosen candidate (None for a single-qubit layout, where there is no tree to choose). Logical index i corresponds to the i th returned qubit; that order must be given to the transpiler as the initial layout, so the tree edges land on physical couplings without a layout search.

Return type:

tuple[IQMCircuit, list[int], TreeCandidate | None]