Introduction¶
dwave-system enables easy incorporation of the D-Wave system as a sampler
in either a hybrid quantum-classical solution, using
LeapHybridSampler()
, for example, or
dwave-hybrid samplers such as
KerberosSampler
, or directly using
DWaveSampler()
.
Note
For applications that require detailed control on communication with the remote compute resource (a D-Wave QPU or Leap’s hybrid solvers), see dwave-cloud-client.
D-Wave System Documentation describes D-Wave quantum computers and Leap hybrid solvers, including features, parameters, and properties. It also provides guidance on programming the D-Wave system, including how to formulate problems and configure parameters.
Example¶
This example solves a small example of a known graph problem, minimum
vertex cover. It uses the NetworkX
graphic package to create the problem, Ocean’s dwave_networkx
to formulate the graph problem as a BQM, and dwave-system’s
DWaveSampler()
to use a D-Wave system as the sampler.
dwave-system’s EmbeddingComposite()
handles mapping
between the problem graph to the D-Wave system’s numerically indexed qubits,
a mapping known as minor-embedding.
>>> import networkx as nx
>>> import dwave_networkx as dnx
>>> from dwave.system import DWaveSampler, EmbeddingComposite
...
>>> s5 = nx.star_graph(4) # a star graph where node 0 is hub to four other nodes
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> print(dnx.min_vertex_cover(s5, sampler))
[0]