Skip to content

Commit 019235f

Browse files
Update dfs_recursion.py
1 parent 967ee42 commit 019235f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Algorithm_with_DataStructure/dfs_recursion.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def dfs(graph, start_node):
4242
visited[node] = 1
4343
print(node)
4444
stack.extend(reversed(graph[node])) # reversed를 사용하여 깊이 우선 탐색을 유지
45-
return visited
4645

4746
# 그래프를 인접 리스트로 표현
4847
graph = {
@@ -54,6 +53,4 @@ def dfs(graph, start_node):
5453
}
5554

5655
# DFS 알고리즘 실행
57-
result = dfs(graph, 1)
58-
print(result)
59-
# 출력: 1 2 4 5 3
56+
dfs(graph, 1) # 1 2 4 5 3

0 commit comments

Comments
 (0)