{"version":"1.0","type":"rich","title":"Code searches a Tree of nodes, depth-first","description":"This example visualizes a depth-first search of a tree, showing the search path as nodes are visited and discarded. It uses a custom Node class in Python to build the tree structure, with each node holding a value and a list of children. The dfs function traverses the tree using a stack, popping nodes to check their values and printing each visited node to display the search order. The code defines two sample trees and searches for a specific target value, demonstrating how the algorithm explores branches before backtracking.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-e3ce337086804c3e419e?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}