ContinuousTime.set_hamiltonian(gamma=0.1, type='adjacency', marked=[])[source]#

Set the Hamiltonian.

The Hamiltonian takes the form of -gamma*C wheres C is either the adjacency matrix or the Laplacian matrix. If marked vertices are specified, the Hamiltonian is modified as described in the Notes section. Once the Hamiltonian has been established, the evolution operator is updated accordingly.

gammafloat, default=0.1

The value of gamma.

type: {‘adjacency’, ‘laplacian’}

Two types of Hamiltonian are used: 'A' is shorthand for 'adjacency' (default). 'L' is shorthand for 'laplacian'.

markedlist of vertices, default=[]

List of vertices to be marked. If empty list, no vertex is marked.


If gamma is None or complex.


If gamma < 0.


The Hamiltonian is given by [1] [2]

\[H = -\gamma C - \sum_{m \in M} \ket m \bra m,\]

where \(C\) is either the adjacency matrix or the Laplacian matrix. The set \(M\) specifies the marked vertices via the argument marked=M. For instance, marked={0} specifies that \(v_0\) is the marked vertex. The default is \(M=\emptyset\).



E. Farhi and S. Gutmann. “Quantum computation and decision trees”. Physical Review A, 58(2):915–928, 1998. ArXiv:quant-ph/9706062.


A. M. Childs and J. Goldstone. “Spatial search by quantum walk”, Phys. Rev. A 70, 022314, 2004.