qrisp.quantum_backtracking.QuantumBacktrackingTree.init_node#

QuantumBacktrackingTree.init_node(path)[source]#

Initializes the state of a given node.

Parameters:
pathList

List of the branch labels indicating the path from the root to the node.

Examples

We initialize a backtracking tree in the 101 node.

from qrisp import auto_uncompute, QuantumBool, QuantumFloat
from qrisp.quantum_backtracking import QuantumBacktrackingTree

@auto_uncompute
def reject(tree):
    return QuantumBool()

@auto_uncompute
def accept(tree):
    return QuantumBool()

tree = QuantumBacktrackingTree(3, QuantumFloat(
    1, name = "branch_qf*"), accept, reject)

tree.init_node([1,0,1])