Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.optimization.applications.ising.graph_partition

Convert graph partitioning instances into Pauli list Deal with Gset format. See https://web.stanford.edu/~yyye/yyye/Gset/

Functions

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

get_graph_solution

get_graph_solution(x)

GitHub

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

Generate Hamiltonian for the graph partitioning

Notes

Goals:

1 separate the vertices into two set of the same size 2 make sure the number of edges between the two set is minimized.

Hamiltonian:

H = H_A + H_B H_A = sum_{(i,j)in E}{(1-ZiZj)/2} H_B = (sum_{i}{Zi})^2 = sum_{i}{Zi^2}+sum_{i!=j}{ZiZj} H_A is for achieving goal 2 and H_B is for achieving goal 1.

Parameters

weight_matrix (numpy.ndarray) – adjacency matrix.

Returns

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

Return type

WeightedPauliOperator

objective_value

objective_value(x, w)

GitHub

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.