dwave.system.samplers.DWaveSampler.to_networkx_graph

DWaveSampler.to_networkx_graph()[source]

Converts DWaveSampler’s structure to a Chimera or Pegasus NetworkX graph.

Returns:
networkx.Graph graph.
Either an (m, n, t) Chimera lattice or a Pegasus lattice of size m.
Return type:G

Examples

This example converts a selected D-Wave system solver to a graph and verifies it has over 2000 nodes.

>>> from dwave.system import DWaveSampler
...
>>> sampler = DWaveSampler(solver={'qpu': True})
>>> g = sampler.to_networkx_graph()      # doctest: +SKIP
>>> len(g.nodes) > 2000                  # doctest: +SKIP
True