[알고리즘] DFS & BFS 패턴
DFS 재귀 procedure DFS(G, v) is label v as discovered for all directed edges from v to w that are in G.adjacentEdges(v) do // 넣을 때 방문 확인 및 처리를 한다 if vertex w is not labeled as discovered then recursively call DFS(G, w) 반복 procedure DFS_iterative(G, v) is let S be a stack S.push(v) while S is not empty do v = S.pop() // 꺼낸 다음에 방문 확인 및 처리를 한다 if v is not labeled as discovered then label v as discovered for all edges from v to w in G.