Skip to content

Commit bae5cc8

Browse files
authored
Update top_sort.md
Each node in the graph was being traversed irrespective of it being visited already in the previous traversals. Fixed that bug with the if condition in top_sort method's for loop.
1 parent ce1fa47 commit bae5cc8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graphs/top_sort.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def top_sort(graph):
2323
return list(sorted_nodes)
2424

2525

26-
def dfs(graph, start_node, visited, sorted\_nodes):
26+
def dfs(graph, start_node, visited, sorted_nodes):
2727
visited.add(start_node)
2828
if start_node in graph:
2929
neighbors = graph[start_node]

0 commit comments

Comments
 (0)