Embedding#

Provides functions that map binary quadratic models (BQM) and samples between a source graph and a target graph.

Embedding#

For an introduction to minor-embedding, see the Minor Embedding section.

Find Generic Embeddings#

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.

minorminer.find_embedding(S, T, **params)

Heuristically attempt to find a minor-embedding of source graph S into a target graph T.

Find QPU Embeddings#

Minor-embedding in target graphs with Chimera, Pegasus, and Zephyr topology.

chimera.find_clique_embedding(k[, m, n, t, ...])

Find an embedding for a clique in a Chimera graph.

chimera.find_biclique_embedding(a, b[, m, ...])

Find an embedding for a biclique in a Chimera graph.

chimera.find_grid_embedding(dim, m[, n, t])

Find an embedding for a grid in a Chimera graph.

pegasus.find_clique_embedding(k[, m, ...])

Find an embedding for a clique in a Pegasus graph.

pegasus.find_biclique_embedding(a, b[, m, ...])

Find an embedding for a biclique in a Pegasus graph.

zephyr.find_clique_embedding(k[, m, ...])

Find an embedding for a clique in a Zephyr graph.

zephyr.find_biclique_embedding(a, b[, m, ...])

Find an embedding for a biclique in a Zephyr graph.

Embed Problems#

embed_bqm(source_bqm[, embedding, ...])

Embed a binary quadratic model onto a target graph.

embed_ising(source_h, source_J, embedding, ...)

Embed an Ising problem onto a target graph.

embed_qubo(source_Q, embedding, target_adjacency)

Embed a QUBO onto a target graph.

Analyze Embeddings#

diagnose_embedding(emb, source, target)

Diagnose a minor embedding.

is_valid_embedding(emb, source, target)

A simple (bool) diagnostic for minor embeddings.

verify_embedding(emb, source, target[, ...])

A simple (exception-raising) diagnostic for minor embeddings.

Chain Strength#

Utility functions for calculating chain strength.

uniform_torque_compensation(bqm[, ...])

Set chain strength to compensate for chain-breaking torque.

scaled(bqm[, embedding, prefactor])

Set chain strength that is scaled to the problem's bias range.

Helper Functions#

adjacency_to_edges(adjacency)

Convert an adjacency object to an edge iterator.

chain_to_quadratic(chain, target_adjacency, ...)

Determine the quadratic biases that induce the given chain.

draw_chimera_bqm(bqm[, width, height])

Represent a binary quadratic model as a Chimera graph.

edgelist_to_adjacency(edgelist)

Convert an iterator of edges to an adjacency dict.

EmbeddedStructure Class#

EmbeddedStructure(target_edges, embedding)

Embedding structure for a target graph and minor embedding.

For all properties and methods, see the EmbeddedStructure class.

EmbeddedStructure.chain_edges(u)

Iterate over edges contained in the chain for variable u.

EmbeddedStructure.chain_strength

Return the chain strength selected for embedding.

EmbeddedStructure.embed_bqm(source_bqm[, ...])

Embed a binary quadratic model onto a target graph.

EmbeddedStructure.interaction_edges(u, *args)

Iterate over edges between the chains for variables u and v.

EmbeddedStructure.max_chain_length

Maximum chain length in the embedding.

Unembedding#

unembed_sampleset(target_sampleset, ...[, ...])

Unembed a sample set.

Diagnose Chains#

broken_chains(samples, chains)

Find the broken chains for the given samples.

chain_break_frequency(samples_like, embedding)

Determine the frequency of chain breaks in the given samples.

Handle Broken Chains#

Unembedding samples with broken chains.

discard(samples, chains)

Discard broken chains.

majority_vote(samples, chains)

Unembed samples using the most common value for broken chains.

MinimizeEnergy(bqm, embedding)

Unembed samples by minimizing local energy for broken chains.

weighted_random(samples, chains)

Unembed samples using weighed random choice for broken chains.

Helper Functions#

target_to_source(target_adjacency, embedding)

Derive the source adjacency from an embedding and target adjacency.

Exceptions#

EmbeddingError

Base class for all embedding exceptions.

MissingChainError(snode)

Raised if a node in the source graph has no associated chain.

ChainOverlapError(tnode, snode0, snode1)

Raised if two source nodes have an overlapping chain.

DisconnectedChainError(snode)

Raised if a chain is not connected in the target graph.

InvalidNodeError(snode, tnode)

Raised if a chain contains a node not in the target graph.

MissingEdgeError(snode0, snode1)

Raised when two source nodes sharing an edge to not have a corresponding edge between their chains.