Visualizes the statevector graph.

posdict, optional

A dictionary indicating the positional layout of the nodes. For more information visit this page By default is suitable will be generated.


We initialize a backtracking tree and visualize:

from qrisp import auto_uncompute, QuantumBool, QuantumFloat
from qrisp.quantum_backtracking import QuantumBacktrackingTree
import matplotlib.pyplot as plt

def reject(tree):
    return QuantumBool()

def accept(tree):
    return (tree.branch_qa[0] == 1) & (tree.branch_qa[1] == 1) & (tree.branch_qa[2] == 1)
>>> tree = QuantumBacktrackingTree(3, QuantumFloat(1, name = "branch_qf*"), accept, reject)
>>> tree.init_node([])
>>> tree.visualize_statevector()
>>> plt.show()
Root statevector plot
>>> tree = tree.copy()
>>> tree.init_phi([1,1,1])
>>> tree.visualize_statevector()
Root statevector plot