dwave_networkx.algorithms.independent_set.maximum_weighted_independent_set_qubo

maximum_weighted_independent_set_qubo(G, weight=None, lagrange=2.0)[source]

Return the QUBO with ground states corresponding to a maximum weighted independent set.

Parameters:
  • G (NetworkX graph) –
  • weight (string, optional (default None)) – If None, every node has equal weight. If a string, use this node attribute as the node weight. A node without this attribute is assumed to have max weight.
  • lagrange (optional (default 2)) – Lagrange parameter to weight constraints (no edges within set) versus objective (largest set possible).
Returns:

QUBO – The QUBO with ground states corresponding to a maximum weighted independent set.

Return type:

dict

Examples

>>> from dwave_networkx.algorithms.independent_set import maximum_weighted_independent_set_qubo
...
>>> G = nx.path_graph(3)
>>> Q = maximum_weighted_independent_set_qubo(G, weight='weight', lagrange=2.0)
>>> Q[(0, 0)]
-1.0
>>> Q[(1, 1)]
-1.0
>>> Q[(0, 1)]
2.0