pyCTQW.MPI.Graph

class Graph(N, filename=None, filetype=None, d=None, amp=None, layout='spring', delimiter=None)

Bases: pyCTQW.MPI.ctqw.QuantumWalkP1

Performs and analyses 1 particle continuous-time quantum walks on graphs

Parameters:N (int) – number of nodes to initialize the walker with. Nodes are labeled \(j\in\{0,N-1\}\).

Example

To create a CTQW Graph object for a 10 node graph,

>>> walk = pyCTQW.MPI.Graph(10)

Note

if filename AND filetype are provided, this automatically creates a PETSc Hamiltonian matrix, neglecting the need to run createH(). For details on the other keyword arguments, see createH().

Method Summary

Graph.clearLiveGraph() Destroys the live plot object previously created by Graph.plotLiveGraph().
Graph.createH(filename, filetype[, d, amp, ...]) Generate the Hamiltonian of the graph.
Graph.createInitState(initState) Generate the initial state of the quantum walk.
Graph.destroy() Destroys the 1 particle quantum walk object, and all associated PETSc matrices/vectors.
Graph.exportState(filename, filetype) Exports the final state of the quantum walk to a file.
Graph.importInitState(filename, filetype) Imports the initial state of the quantum walk from a file.
Graph.plot(filename) Creates a plot of probability vs node.
Graph.plotGraph([output, probX, size]) Creates a plot of probability vs node superimposed on a 3D visualisation of the graph vertices.
Graph.plotLiveGraph(dt[, size]) Creates a live, updated plot of probability vs node superimposed on a 3D visualisation of the graph vertices.
Graph.plotNodes(filename[, t]) Creates a plot of the node probablities over time.
Graph.propagate(t[, method]) Propagates the quantum walk for time t.
Graph.psiToInit() Copies the state self.psi to self.psi0.
Graph.watch(nodes) Creates a handle that watches node probability during propagation.

Attribute Summary

Attribute Type Description
Graph.psi0 petsc4py.PETSc.Vec() \(N\) element PETSc vector containing the initial state
Graph.psi petsc4py.PETSc.Vec() \(N\) element PETSc vector containing the final state after the last propagation.
Graph.H pyCTQW.MPI.ctqw.Hamiltonian() Hamiltonian matrix
Graph.EigSolver pyCTQW.MPI.ctqw.EigSolver() The Hamiltonian eigensolver
Graph.handle pyCTQW.MPI.ctqw.nodeHandle() A node handle, created if nodes are being watched for probability.