dwave.embedding.chimera.find_biclique_embedding¶
-
find_biclique_embedding
(a, b, m, n=None, t=None, target_edges=None)[source]¶ Find an embedding for a biclique in a Chimera graph.
Given a biclique (a bipartite graph where every vertex in a set in connected to all vertices in the other set) and a target Chimera graph size or edges, attempts to find an embedding.
Parameters: - a (int/iterable) – Left shore of the biclique to embed. If a is an integer, generates an embedding for a biclique with the left shore of size a labelled [0,a-1]. If a is an iterable of nodes, generates an embedding for a biclique with the left shore of size len(a) labelled for the given nodes.
- b (int/iterable) – Right shore of the biclique to embed.If b is an integer, generates an embedding for a biclique with the right shore of size b labelled [0,b-1]. If b is an iterable of nodes, generates an embedding for a biclique with the right shore of size len(b) 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: A 2-tuple containing:
dict: An embedding mapping the left shore of the biclique to the Chimera lattice.
dict: An embedding mapping the right shore of the biclique to the Chimera lattice.
Return type: Examples
This example finds an embedding for an alphanumerically labeled biclique in a single Chimera unit cell.
>>> from dwave.embedding.chimera import find_biclique_embedding ... >>> left, right = find_biclique_embedding(['a', 'b', 'c'], ['d', 'e'], 1, 1) >>> print(left, right) # doctest: +SKIP {'a': [4], 'b': [5], 'c': [6]} {'d': [0], 'e': [1]}