dwave.embedding.chain_to_quadratic#

chain_to_quadratic(chain, target_adjacency, chain_strength)[source]#

Determine the quadratic biases that induce the given chain.

Parameters:
  • chain (iterable) – The variables that make up a chain.

  • target_adjacency (dict/networkx.Graph) – Target adjacency as a dict of form {s: Ns, ...}, where s is a variable in the target graph and Ns is the set of neighbors of s; or a NetworkX graph.

  • chain_strength (float) – Magnitude of the quadratic bias that should be used to create chains.

Returns:

The quadratic biases that induce the given chain.

Return type:

dict[edge, float]

Raises:

ValueError – If the variables in chain do not form a connected subgraph of the target.

Examples

>>> from dwave.embedding import chain_to_quadratic
>>> chain = {1, 2}
>>> target_adjacency = {0: {1, 2}, 1: {0, 2}, 2: {0, 1}}
>>> chain_to_quadratic(chain, target_adjacency, 1)
{(1, 2): -1}