edge_driver¶
- edge_driver(graph, reward, *, n_qubits=None)[source]¶
Edge-driver Hamiltonian rewarding edges whose endpoints match
reward.Mirrors the formulations in pennylane.qaoa.cost.edge_driver:
reward⊆{"00","01","10","11"};"01"and"10"are treated as the undirected pair (must appear together or not at all).len(reward) ∈ {0, 4}reduces to a constant identity term.Otherwise the difference between rewarded and penalised energies is always
1.
The graph nodes must be integer qubit indices.
n_qubitsmay be provided to preserve isolated trailing qubits.- Return type: