dimod.AdjDictBQM.relabel_variables

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

Relabel variables of a binary quadratic model 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 quadratic model is updated in-place; otherwise, a new binary quadratic model is returned.
Returns:

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