BinaryQuadraticModel.remove_interactions_from(interactions)[source]

Remove all specified interactions from the binary quadratic model.

Parameters: interactions (iterable[[variable, variable]]) – A collection of interactions. Each interaction should be a 2-tuple of variables in the binary quadratic model.

Notes

Any interaction not in the binary quadratic model is ignored.

Examples

This example creates an Ising model with three variables that has interactions between two, and then removes an interaction.

>>> import dimod
...
>>> bqm = dimod.BinaryQuadraticModel({}, {('a', 'b'): -1.0, ('b', 'c'): 1.0}, 0.0, dimod.SPIN)
>>> bqm.remove_interactions_from([('b', 'c'), ('a', 'c')])  # ('a', 'c') is not an interaction, so ignored