DFS recursive DFS(graph, node, visited): if node not in visited: process(node) add node to visited for each neighbor in g