dwave.embedding.chimera.find_grid_embedding

find_grid_embedding(dim, m, n=None, t=4)[source]

Find an embedding for a grid in a Chimera graph.

Given grid dimensions and a target Chimera graph size, attempts to find an embedding.

Parameters
  • dim (iterable[int]) – Sizes of each grid dimension. Length can be between 1 and 3.

  • m (int) – Number of rows in the Chimera lattice.

  • n (int, optional, default=m) – Number of columns in the Chimera lattice.

  • t (int, optional, default 4) – Size of the shore within each Chimera tile.

Returns

An embedding mapping a grid to the Chimera lattice.

Return type

dict

Examples

This example finds an embedding for a 2x3 grid in a 12x12 lattice of Chimera unit cells.

>>> from dwave.embedding.chimera import find_grid_embedding
...
>>> embedding = find_grid_embedding([2, 3], m=12, n=12, t=4)
>>> embedding  
{(0, 0): [0, 4],
 (0, 1): [8, 12],
 (0, 2): [16, 20],
 (1, 0): [96, 100],
 (1, 1): [104, 108],
 (1, 2): [112, 116]}