dimod.AdjDictBQM.remove_variable

AdjDictBQM.remove_variable(v=None)[source]

Remove a variable and its associated interactions.

Parameters

v (variable, optional) – The variable to be removed from the binary quadratic model (BQM). If not provided, the last variable added is removed.

Returns

The removed variable.

Return type

variable

Raises

ValueError – If the BQM is empty or if v is not a variable.