dimod.to_networkx_graph#

to_networkx_graph(bqm, node_attribute_name='bias', edge_attribute_name='bias')[source]#

Convert a binary quadratic model to NetworkX graph format.

Note that NetworkX must be installed for this method to work.

Parameters:
  • node_attribute_name (hashable, optional, default='bias') – Attribute name for linear biases.

  • edge_attribute_name (hashable, optional, default='bias') – Attribute name for quadratic biases.

Returns:

A NetworkX graph with biases stored as node/edge attributes.

Return type:

networkx.Graph