AdjMapBQM.to_coo(fp=None, vartype_header=False)

Serialize the binary quadratic model to a COOrdinate format encoding.

COOrdinate is a sparse encoding for binary quadratic models.

  • fp (file, optional) – .write()-supporting file object to save the linear and quadratic biases of a binary quadratic model to. The model is stored as a list of 3-tuples, (i, j, bias), where \(i=j\) for linear biases. If not provided, returns a string.
  • vartype_header (bool, optional, default=False) – If true, the binary quadratic model’s variable type as prepended to the string or file as a header.


Variables must use index lables (numeric lables). Binary quadratic models saved to COOrdinate format encoding do not preserve offsets.


This method will be deprecated in the future. The preferred pattern is to use dump() or dumps() directly.