DFS *

Undirected Graph

Explanation
Problem

from: use this when graph is undirected, can omit when graph is directed

Time: O(V + E): iter V and then iter E, connected to the V

Space: O(V), V is the number of vertices

Undirected graph는 정점간 연결되면 -> <- 양 방향이기 때문에 black 방문 시 gray 방문과 같으 효과르르 갖는다.

Directed Graph

directed graph는 한 방향 이기 때문에 balck을 방문해도 괜찮다

Last updated