dwave.embedding.pegasus.find_biclique_embedding#

find_biclique_embedding(a, b, m=None, target_graph=None)[source]#

Find an embedding for a biclique in a Pegasus 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 Pegasus 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 tiles in a row of a square Pegasus graph. Required to generate an m-by-m Pegasus graph when target_graph is None.

  • target_graph (networkx.Graph) – A Pegasus graph. Required when m is None.

Returns:

A 2-tuple containing:

dict: An embedding mapping the left shore of the biclique to the Pegasus lattice.

dict: An embedding mapping the right shore of the biclique to the Pegasus lattice.

Return type:

tuple

Examples

This example finds an embedding for an alphanumerically labeled biclique in a small Pegasus graph

>>> from dwave.embedding.pegasus import find_biclique_embedding
...
>>> left, right = find_biclique_embedding(['a', 'b', 'c'], ['d', 'e'], 2)
>>> print(left, right)  
{'a': [40], 'b': [41], 'c': [42]} {'d': [4], 'e': [5]}