Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

qiskit.optimization.applications.ising.max_cut

Convert max-cut instances into Pauli list Deal with Gset format. See https://web.stanford.edu/~yyye/yyye/Gset/(opens in a new tab) Design the max-cut object w as a two-dimensional np.array e.g., w[i, j] = x means that the weight of a edge between i and j is x Note that the weights are symmetric, i.e., w[j, i] = x always holds.

Functions

get_graph_solution(x)Get graph solution from binary string.
get_operator(weight_matrix)Generate Hamiltonian for the max-cut problem of a graph.
max_cut_value(x, w)Compute the value of a cut.

get_graph_solution

get_graph_solution(x)

GitHub(opens in a new tab)

Get graph solution from binary string.

Parameters

x (numpy.ndarray) – binary string as numpy array.

Returns

graph solution as binary numpy array.

Return type

numpy.ndarray

get_operator

get_operator(weight_matrix)

GitHub(opens in a new tab)

Generate Hamiltonian for the max-cut problem of a graph.

Parameters

weight_matrix (numpy.ndarray) – adjacency matrix.

Returns

operator for the Hamiltonian float: a constant shift for the obj function.

Return type

WeightedPauliOperator

max_cut_value

max_cut_value(x, w)

GitHub(opens in a new tab)

Compute the value of a cut.

Parameters

  • x (numpy.ndarray) – binary string as numpy array.
  • w (numpy.ndarray) – adjacency matrix.

Returns

value of the cut.

Return type

float

Was this page helpful?
Report a bug or request content on GitHub.