dwave.optimization.model.Model.to_networkx#

Model.to_networkx()#

Convert the model to a NetworkX graph.

Note

Currently requires the installation of a GNU compiler.

Returns:

A NetworkX graph.

Examples

This example converts a model to a graph.

>>> from dwave.optimization.model import Model
>>> model = Model()
>>> c = model.constant(8)
>>> i = model.integer((20, 30))
>>> g = model.to_networkx()