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 an (m, n, t) Chimera lattice, a Pegasus lattice of size m or a Zephyr lattice of size m.

Return type

networkx.Graph

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()
>>> g = sampler.to_networkx_graph()      
>>> len(g.nodes) > 2000                  
True