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.vertex_cover

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

Functions

check_full_edge_coverage(x, w)param xbinary string as numpy array.
get_graph_solution(x)Get graph solution from binary string.
get_operator(weight_matrix)Generate Hamiltonian for the vertex cover :param weight_matrix: adjacency matrix.

check_full_edge_coverage

check_full_edge_coverage(x, w)

GitHub

Parameters

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

Returns

value of the cut.

Return type

float

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 vertex cover :param weight_matrix: adjacency matrix. :type weight_matrix: numpy.ndarray

Returns

operator for the Hamiltonian and a constant shift for the obj function.

Return type

tuple(WeightedPauliOperator, float)

Goals: 1 color some vertices as red such that every edge is connected to some red vertex 2 minimize the vertices to be colored as red

Hamiltonian: H = A * H_A + H_B H_A = sum_{(i,j)in E}{(1-Xi)(1-Xj)} H_B = sum_{i}{Zi}

H_A is to achieve goal 1 while H_b is to achieve goal 2. H_A is hard constraint so we place a huge penality on it. A=5. Note Xi = (Zi+1)/2

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