dwave.system.samplers.DWaveSampler.to_networkx_graph#

DWaveSampler.to_networkx_graph()[source]#

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

Returns:

Either a Chimera lattice of shape [m, n, t], a Pegasus lattice of shape [m] or a Zephyr lattice of size [m,t].

Return type:

networkx.Graph

Examples

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

>>> from dwave.system import DWaveSampler
...
>>> sampler = DWaveSampler()
>>> g = sampler.to_networkx_graph()      
>>> len(g.nodes) > 5000                  
True