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]. Ifa
is an iterable, the left shore will be labelled bya
.b (int/iterable) – Describes the right shore of the biclique to embed. If
b
is an integer anda
is an iterable, the right shore will be labelled [0, b-1]. If botha
andb
are integers, the right shore will be labelled [a, a+b-1]. Ifb
is an iterable, the right shore will be labelled byb
.m (int) – Number of tiles in a row of a square Zephyr graph. Required to generate an
m
-by-m
Zephyr graph whentarget_graph
is None.target_graph (
networkx.Graph
) – A Zephyr graph. Required whenm
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:
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,)}