dimod.binary.BinaryQuadraticModel.degrees#

BinaryQuadraticModel.degrees(array: bool = False, dtype: ~numpy.dtype[~typing.Any] | None | type[~typing.Any] | ~numpy._typing._dtype_like._SupportsDType[~numpy.dtype[~typing.Any]] | str | tuple[~typing.Any, int] | tuple[~typing.Any, ~typing.SupportsIndex | ~collections.abc.Sequence[~typing.SupportsIndex]] | list[~typing.Any] | ~numpy._typing._dtype_like._DTypeDict | tuple[~typing.Any, ~typing.Any] = <class 'int'>) ndarray | Mapping[Hashable, int][source]#

Return the degrees of a binary quadratic model’s variables.

Parameters:
  • array – If True, returns a numpy.ndarray; otherwise returns a dict.

  • dtype – The data type of the returned degrees. Applies only if array==True.

Returns:

Degrees of all variables.