tlquantum.maxcut.calculate_cut

tlquantum.maxcut.calculate_cut(spins, spins1, spins2, weights, get_cut=False, alternate=None)[source]

Calculates the MaxCut value of a given state (set of spins) for a given graph (weights). The weights can be given in an arbitrary order, which makes the indices of the spins for each weight necessary.

Parameters:
spinsList/tensor of real floats, state spin values
wspins1List/tensor of ints, spin indices
wspins2List/tensor of ints, spin indices
weightsList/tensor of real floats, graph weights
get_cutBoolean, if False - return Ising energy definition, if True - return traditional MaxCut metric
Returns:
The energy/MaxCut metric for the state of spins of the graph described by spins1, spins2, and weights.