greedy_max_cut

Contents

greedy_max_cut#

iqm.applications.maxcut.greedy_max_cut(max_cut_problem)[source]#

Standard greedy algorithm for maxcut problem class.

Steps:

  1. Start with a random assignment of nodes in two groups.

  2. Iterate over all nodes

  3. For each node, switch it to the other group if it improves the cost function.

  4. Repeat steps 2-3 until no node can be switched.

  5. Return the final assignment.

Parameters:

max_cut_problem (MaxCutInstance | Graph) – A problem instance of maxcut or a Graph.

Returns:

A bitstring solution.

Return type:

str