dimod.binary.BinaryQuadraticModel.degrees

BinaryQuadraticModel.degrees(array: bool = False, dtype: typing.Union[numpy.dtype, None, type, numpy.typing._dtype_like._SupportsDType[numpy.dtype], str, typing.Tuple[typing.Any, int], typing.Tuple[typing.Any, typing.Union[typing_extensions.SupportsIndex, typing.Sequence[typing_extensions.SupportsIndex]]], typing.List[typing.Any], numpy.typing._dtype_like._DTypeDict, typing.Tuple[typing.Any, typing.Any]] = <class 'int'>) Union[numpy.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.