dimod icon indicating copy to clipboard operation
dimod copied to clipboard

`BQM.is_variable()` and `BQM.is_scalar()` or similar

Open arcondello opened this issue 4 years ago • 0 comments

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

arcondello avatar Jul 26 '21 22:07 arcondello