qbraid.visualization.lattice_positions

lattice_positions(topology, qubits)[source]

Map qubit ids to (x, y) plot positions using a device topology config.

Supports the square-lattice (row-major ids, e.g. Rigetti Cepheus) and square-lattice-clipped (ids numbered sequentially across populated cells, e.g. IQM Crystal) topology types served on qBraid device documents.

Parameters:
  • topology (dict | None) – The device document’s topology config, or None.

  • qubits (Iterable[int]) – Qubit ids to place.

Return type:

dict | None

Returns:

Mapping of qubit id to (x, y), or None when the topology type is unknown (callers should fall back to a force-directed layout).