dwave.optimization.model.Model.num_nodes#

Model.num_nodes()#

Number of nodes in the directed acyclic graph for the model.

See also

num_symbols()

Examples

This example add a single (size 20) decision symbol and a single (size 3) constant symbol checks the number of nodes in the model.

>>> from dwave.optimization.model import Model
>>> model = Model()
>>> c = model.constant([1, 5, 8.4])
>>> i = model.integer(20, upper_bound=100)
>>> model.num_nodes()
2