Embedding#
Provides functions that map binary quadratic models and samples between a source graph and a target graph.
For an introduction to minor-embedding, see Minor-Embedding.
Generators#
Tools for finding embeddings.
Generic#
minorminer is a heuristic tool for minor embedding: given a minor and target graph, it tries to find a mapping that embeds the minor into the target.
|
Heuristically attempt to find a minor-embedding of source graph S into a target graph T. |
Chimera#
Minor-embedding in Chimera-structured target graphs.
|
Find an embedding for a clique in a Chimera graph. |
|
Find an embedding for a biclique in a Chimera graph. |
|
Find an embedding for a grid in a Chimera graph. |
Pegasus#
Minor-embedding in Pegasus-structured target graphs.
|
Find an embedding for a clique in a Pegasus graph. |
|
Find an embedding for a biclique in a Pegasus graph. |
Zephyr#
Minor-embedding in Zephyr-structured target graphs.
|
Find an embedding for a clique in a Zephyr graph. |
|
Find an embedding for a biclique in a Zephyr graph. |
Utilities#
|
Embed a binary quadratic model onto a target graph. |
|
Embed an Ising problem onto a target graph. |
|
Embed a QUBO onto a target graph. |
|
Unembed a sample set. |
Diagnostics#
|
Determine the frequency of chain breaks in the given samples. |
|
Diagnose a minor embedding. |
|
A simple (bool) diagnostic for minor embeddings. |
|
A simple (exception-raising) diagnostic for minor embeddings. |
Chain Strength#
Utility functions for calculating chain strength.
Examples
This example uses uniform_torque_compensation()
, given a prefactor of 2,
to calculate a chain strength that EmbeddingComposite
then uses.
>>> from functools import partial
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> from dwave.embedding.chain_strength import uniform_torque_compensation
...
>>> Q = {(0,0): 1, (1,1): 1, (2,3): 2, (1,2): -2, (0,3): -2}
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> # partial() can be used when the BQM or embedding is not accessible
>>> chain_strength = partial(uniform_torque_compensation, prefactor=2)
>>> sampleset = sampler.sample_qubo(Q, chain_strength=chain_strength, return_embedding=True)
>>> sampleset.info['embedding_context']['chain_strength']
1.224744871391589
Chain strength that attempts to compensate for torque that would break the chain. |
|
|
Chain strength that is scaled to the problem bias range. |
Chain-Break Resolution#
Unembedding samples with broken chains.
Generators#
|
Discard broken chains. |
|
Unembed samples using the most common value for broken chains. |
|
Unembed samples using weighed random choice for broken chains. |
Callable Objects#
|
Unembed samples by minimizing local energy for broken chains. |
Exceptions#
Base class for all embedding exceptions. |
|
|
Raised if a node in the source graph has no associated chain. |
|
Raised if two source nodes have an overlapping chain. |
Raised if a chain is not connected in the target graph. |
|
|
Raised if a chain contains a node not in the target graph. |
|
Raised when two source nodes sharing an edge to not have a corresponding edge between their chains. |
Classes#
- class EmbeddedStructure(target_edges, embedding)[source]#
Processes an embedding and a target graph to collect target edges into those within individual chains, and those that connect chains. This is used elsewhere to embed binary quadratic models into the target graph.
- Parameters:
target_edges (iterable[edge]) – An iterable of edges in the target graph. Each edge should be an iterable of 2 hashable objects.
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.
This class is a dict, and acts as an immutable duplicate of embedding.