dwave.embedding.embed_qubo¶

embed_qubo
(source_Q, embedding, target_adjacency, chain_strength=None)[source]¶ Embed a QUBO onto a target graph.
Parameters:  source_Q (dict[(variable, variable), bias]) – Coefficients of a quadratic unconstrained binary optimization (QUBO) model.
 embedding (dict) – Mapping from source graph to target graph as a dict of form {s: {t, …}, …}, where s is a sourcemodel variable and t is a targetmodel variable.
 target_adjacency (dict/
networkx.Graph
) – Adjacency of the target graph as a dict of form {t: Nt, …}, where t is a targetgraph variable and Nt is its set of neighbours.  chain_strength (float/mapping/callable, optional) – Magnitude of the quadratic bias (in SPINspace) applied between
variables to form a chain, with the energy penalty of chain breaks
set to 2 * chain_strength. If a mapping is passed, a
chainspecific strength is applied. If a callable is passed, it
will be called on chain_strength(source_bqm, embedding)
and should return a float or mapping, to be interpreted as above.
By default, chain_strength is calculated with
uniform_torque_compensation()
.
Returns: Quadratic biases of the target QUBO.
Return type: dict[(variable, variable), bias]
Examples
This example embeds a triangular QUBO representing a \(K_3\) clique into a square target graph by mapping variable c in the source to nodes 2 and 3 in the target.
>>> import networkx as nx ... >>> target = nx.cycle_graph(4) >>> # QUBO >>> Q = {('a', 'b'): 1, ('b', 'c'): 1, ('a', 'c'): 1} >>> # Variable c is a chain >>> embedding = {'a': {0}, 'b': {1}, 'c': {2, 3}} >>> # Embed and show the resulting biases >>> tQ = dwave.embedding.embed_qubo(Q, embedding, target) >>> tQ # doctest: +SKIP {(0, 1): 1.0, (0, 3): 1.0, (1, 2): 1.0, (2, 3): 4.0, (0, 0): 0.0, (1, 1): 0.0, (2, 2): 2.0, (3, 3): 2.0}
See also