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, ...}, wheresis a variable in the target graph andNsis the set of neighbors ofs; 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:
- 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}