Skip to content

Fixed: #12233 #12249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
comment updated
  • Loading branch information
Ved Prakash Vishwakarma authored and Ved Prakash Vishwakarma committed Oct 20, 2024
commit 7ac458d7462b48fd791f66e908842098f153dd02
2 changes: 1 addition & 1 deletion sorts/topological_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

def topological_sort(start: str, visited: list[str], sort: list[str]) -> list[str]:
"""Perform topological sort on a directed acyclic graph."""
# consider edge direction from top to bottom
current = start
# add current to visited
visited.append(current)
neighbors = edges[current]
# direction not given so consider from top to bottom
# as the current node encounter add it to the topo sort list
sort.append(current)
for neighbor in neighbors:
Expand Down