dwave.graphs.algorithms.max_cut.weighted_maximum_cut#

weighted_maximum_cut(G, sampler, **sampler_args)[source]#

Returns an approximate weighted maximum cut.

Defines an Ising problem with ground states corresponding to a weighted maximum cut and uses the sampler to sample from it.

A weighted maximum cut is a subset S of the vertices of G that maximizes the sum of the edge weights between S and its complementary subset.

Parameters:
  • G (NetworkX graph) – The graph on which to find a weighted maximum cut. Each edge in G should have a numeric weight attribute.

  • sampler (dimod.Sampler) – A dimod sampler.

  • sampler_args – Additional keyword parameters are passed to the sampler.

Returns:

S – A maximum cut of G.

Return type:

set

Notes

Samplers by their nature may not return the optimal solution. This function does not attempt to confirm the quality of the returned sample.