def remove_variable(self, v):
        """Remove variable v and all its interactions from a binary quadratic model.

        Args:
            v (variable):
                The variable to be removed from the binary quadratic model.

        Notes:
            If the specified variable is not in the binary quadratic model, this function does nothing.

        Examples:
            This example creates an Ising model and then removes one variable.

            >>> import dimod
            ...
            >>> bqm = dimod.BinaryQuadraticModel({'a': 0.0, 'b': 1.0, 'c': 2.0},
            ...                            {('a', 'b'): 0.25, ('a','c'): 0.5, ('b','c'): 0.75},
            ...                            -0.5, dimod.SPIN)
            >>> bqm.remove_variable('a')
            >>> 'a' in bqm.linear
            False
            >>> ('b','c') in bqm.quadratic
            True

        """
        if v not in self:
            return

        adj = self.adj

        # first remove all the interactions associated with v
        while adj[v]:
            self.remove_interaction(v, next(iter(adj[v])))

        # remove the variable
        del self.linear[v]

        try:
            # invalidates counterpart
            del self._counterpart
            if self.vartype is not Vartype.BINARY and hasattr(self, '_binary'):
                del self._binary
            elif self.vartype is not Vartype.SPIN and hasattr(self, '_spin'):
                del self._spin
        except AttributeError:
            pass
Remove variable v and all its interactions from a binary quadratic model.

        Args:
            v (variable):
                The variable to be removed from the binary quadratic model.

        Notes:
            If the specified variable is not in the binary quadratic model, this function does nothing.

        Examples:
            This example creates an Ising model and then removes one variable.

            >>> import dimod
            ...
            >>> bqm = dimod.BinaryQuadraticModel({'a': 0.0, 'b': 1.0, 'c': 2.0},
            ...                            {('a', 'b'): 0.25, ('a','c'): 0.5, ('b','c'): 0.75},
            ...                            -0.5, dimod.SPIN)
            >>> bqm.remove_variable('a')
            >>> 'a' in bqm.linear
            False
            >>> ('b','c') in bqm.quadratic
            True