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 aSparsePauliOp
object.A Hamiltonian as
SparsePauliOp
may be used byqiskit
functions that e.g., calculate expectation values.- Parameters:
ham_graph (Graph) – A
Graph
whose nodes and edges have a parameterbias
whose value corresponds to the coefficients before the corresponding Z and ZZ operators in the problem Hamiltonian.- Returns:
The Hamiltonian as
SparsePauliOp
to be used byqiskit
.- Return type: