dwave.embedding.chimera.find_clique_embedding#

find_clique_embedding(k, m=None, n=None, t=None, target_edges=None, target_graph=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, optional, default=None) – 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().

  • target_graph (networkx.Graph) – A Chimera graph constructed by chimera_graph().

Returns:

An embedding mapping a clique to the Chimera lattice.

Return type:

dict

Note

Either target_edges or target_graph must be None. If both are None, a graph with perfect yield is assumed from the parameters m, n, t. If target_edges is not None, at least m must not be None.

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]}