mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-23 09:38:27 +00:00
Issue 12192 fixed with all checks passed
This commit is contained in:
parent
e08aadd00e
commit
239b8c83e4
|
@ -21,7 +21,7 @@ def topological_sort(start: str, visited: list[str], sort: list[str]) -> list[st
|
||||||
# add current to visited
|
# add current to visited
|
||||||
visited.append(current)
|
visited.append(current)
|
||||||
neighbors = edges[current]
|
neighbors = edges[current]
|
||||||
#as we are traversing in from top to down in tree like graph (direction not given) we consider direction from top to down
|
# direction not given so consider from top to bottom
|
||||||
# as the current node encounter add it to the topo sort list
|
# as the current node encounter add it to the topo sort list
|
||||||
sort.append(current)
|
sort.append(current)
|
||||||
for neighbor in neighbors:
|
for neighbor in neighbors:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user