"depth-first search"

Written By Atticus Kuhn
Tags: "public", "project"
:PROPERTIES: :ID: b6b2cc10-78f6-49f4-883f-785d60596389 :mtime: 20231026075340 :ctime: 20231026075338 :END: #+title: depth-first search #+filetags: :public:project: * DFS on Graphs ** DFS in Python #+BEGIN_SRC python def dfs(start_node, graph, already_visited): print(f"visiting {start_node}") for node in adjacent_nodes(start_node, graph): if node not in already_visited: dfs(node, graph, already_visited.add(node)) #+END_SRC * DFS on Trees

Leave your Feedback in the Comments Section