ham_graph_to_ham_operator#
- iqm.qaoa.transforming_functions.ham_graph_to_ham_operator(ham_graph)[source]#
A function to transform Hamiltonian represented as a graph into a
SparsePauliOp.A Hamiltonian as
SparsePauliOpmay be used byqiskitfunctions that e.g., calculate expectation values.- Parameters:
ham_graph (Graph) – A
Graphwhose nodes and edges have a parameterbiaswhose value corresponds to the coefficients before the corresponding Z and ZZ operators in the problem Hamiltonian.- Returns:
The Hamiltonian as
SparsePauliOpto be used byqiskit.- Return type: