dwave.embedding.zephyr.find_biclique_embedding#

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

Find an embedding for a biclique in a Zephyr 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 Zephyr graph, attempts to find an embedding.

Parameters:
  • a (int/iterable) – Describes the left shore of the biclique to embed. If a is an integer, the left shore will be labelled [0, a-1]. If a is an iterable, the left shore will be labelled by a.

  • b (int/iterable) – Describes the right shore of the biclique to embed. If b is an integer and a is an iterable, the right shore will be labelled [0, b-1]. If both a and b are integers, the right shore will be labelled [a, a+b-1]. If b is an iterable, the right shore will be labelled by b.

  • m (int) – Number of tiles in a row of a square Zephyr graph. Required to generate an m-by-m Zephyr graph when target_graph is None.

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

Returns:

A 2-tuple containing:

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

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

Return type:

tuple

Examples

This example finds an embedding for an alphanumerically labeled biclique in a 2x2 Zephyr graph.

>>> from dwave.embedding.zephyr import find_biclique_embedding
>>> left, right = find_biclique_embedding(['a', 'b', 'c'], ['d', 'e'], 2)
>>> print(left, right)
{'a': (0,), 'b': (4,), 'c': (8,)} {'d': (80,), 'e': (84,)}