# dwave.embedding.embed_ising#

Embed an Ising problem onto a target graph.

Parameters:
• source_h (dict[variable, bias]/list[bias]) – Linear biases of the Ising problem. If a list, the list’s indices are used as variable labels.

• source_J (dict[(variable, variable), bias]) – Quadratic biases of the Ising problem.

• embedding (dict) – Mapping from source graph to target graph as a dict of form {s: {t, …}, …}, where s is a source-model variable and t is a target-model variable.

• target_adjacency (dict/networkx.Graph) – Adjacency of the target graph as a dict of form {t: Nt, …}, where t is a target-graph variable and Nt is its set of neighbours.

• chain_strength (float/mapping/callable, optional) – Sets the coupling strength between qubits representing variables that form a chain. Mappings should specify the required chain strength for each variable. Callables should accept the BQM and embedding and return a float or mapping. By default, chain_strength is calculated with uniform_torque_compensation().

Returns:

A 2-tuple:

dict[variable, bias]: Linear biases of the target Ising problem.

dict[(variable, variable), bias]: Quadratic biases of the target Ising problem.

Return type:

tuple

Examples

This example embeds a triangular Ising problem 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)
>>> # Ising problem biases
>>> h = {'a': 0, 'b': 0, 'c': 0}
>>> J = {('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
>>> th, tJ = dwave.embedding.embed_ising(h, J, embedding, target)
>>> th
{0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0}
>>> tJ
{(0, 1): 1.0, (0, 3): 1.0, (1, 2): 1.0, (2, 3): -1.0}