dwavesystems / dwavesystems/dimod
BinaryPolynomial.num_variables attribute
Open
enhancement
- Dominant language
- Python
- Stars
- 143
- Forks
- 91
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 3
Description
To find out how many unique variables a binary polynomial has, the user needs to
```
len(poly.variables)
```
but the implementation of `poly.variables` creates a set https://github.com/dwavesystems/dimod/blob/ae1b5f436eb066f0ffdca06bbed322442e34b7c5/dimod/higherorder/polynomial.py#L167
each time which is convenient but slow.
It would be nice to track the number of variables as an attribute.
Contributor guide
Assessment
This issue has not been assessed yet.