What is a tree?
An undirected graph with no cycles
What is a rooted tree?
Tree with a designated root node where every edge either points away from or towards the root node
what is an adjacency list?
a way to represent a graph as a map from nodes to lists of edges
write generic dis for a graph
function dis(at): if visited[at]: return true visited[at] = true
neighbors = graph[at]
for next in neighbors: dfs(next)
# Start DFS at node zero start_node = 0 dfs(start_node)