dwave.embedding.chimera.find_clique_embedding

find_clique_embedding(k, m, n=None, t=None, target_edges=None)[source]

Find an embedding for a clique in a Chimera graph.

Given the node labels or size of a clique (fully connected graph) and size or edges of the target Chimera graph, attempts to find an embedding.

Parameters
  • k (int/iterable) – Clique to embed. If k is an integer, generates an embedding for a clique of size k labelled [0,k-1]. If k is an iterable of nodes, generates an embedding for a clique of size len(k) labelled for the given nodes.

  • 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.

  • target_edges (iterable[edge]) – A list of edges in the target Chimera graph. Nodes are labelled as returned by chimera_graph().

Returns

An embedding mapping a clique to the Chimera lattice.

Return type

dict

Examples

The first example finds an embedding for a \(K_4\) complete graph in a single Chimera unit cell. The second for an alphanumerically labeled \(K_3\) graph in 4 unit cells.

>>> from dwave.embedding.chimera import find_clique_embedding
...
>>> embedding = find_clique_embedding(4, 1, 1)
>>> embedding  
{0: [4, 0], 1: [5, 1], 2: [6, 2], 3: [7, 3]}
>>> from dwave.embedding.chimera import find_clique_embedding
...
>>> embedding = find_clique_embedding(['a', 'b', 'c'], m=2, n=2, t=4)
>>> embedding  
{'a': [20, 16], 'b': [21, 17], 'c': [22, 18]}