dimod.higherorder.polynomial.BinaryPolynomial.relabel_variables

BinaryPolynomial.relabel_variables(mapping, inplace=True)[source]

Relabel variables of a binary polynomial as specified by mapping.

Parameters:
  • mapping (dict) – Dict mapping current variable labels to new ones. If an incomplete mapping is provided, unmapped variables retain their current labels.
  • inplace (bool, optional, default=True) – If True, the binary polynomial is updated in-place; otherwise, a new binary polynomial is returned.
Returns:

A binary polynomial with the variables relabeled. If inplace is set to True, returns itself.

Return type:

BinaryPolynomial