dimod
dimod copied to clipboard
`BQM.is_variable()` and `BQM.is_scalar()` or similar
For requests like https://github.com/dwavesystems/dimod/issues/921, it would be nice to have some way of detecting whether a BQM/QM are scalars or single variables. Something like
def is_variable(self):
return self.num_variables == 1 and self.offset == 0 and self.is_linear()
def is_scalar(self):
return self.num_variables == 0