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;
Noneuses 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,
0being the best-scoring one.
- Returns:
The GHZ circuit (measured), the physical qubits in logical-qubit order, and the chosen candidate (
Nonefor a single-qubit layout, where there is no tree to choose). Logical indexicorresponds to theith 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]