Skip to content

Commit 7ac458d

Browse files
Ved Prakash VishwakarmaVed Prakash Vishwakarma
Ved Prakash Vishwakarma
authored and
Ved Prakash Vishwakarma
committed
comment updated
1 parent 239b8c8 commit 7ac458d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sorts/topological_sort.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
def topological_sort(start: str, visited: list[str], sort: list[str]) -> list[str]:
1919
"""Perform topological sort on a directed acyclic graph."""
20+
# consider edge direction from top to bottom
2021
current = start
2122
# add current to visited
2223
visited.append(current)
2324
neighbors = edges[current]
24-
# direction not given so consider from top to bottom
2525
# as the current node encounter add it to the topo sort list
2626
sort.append(current)
2727
for neighbor in neighbors:

0 commit comments

Comments
 (0)