Skip to content

Commit 3d3d5aa

Browse files
Fixed
1 parent d0e0ea1 commit 3d3d5aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sorts/topological_sort.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ def topological_sort(start: str, visited: list[str], sort: list[str]) -> list[st
2121
current = start
2222
# Mark the current node as visited
2323
visited.append(current)
24-
# List of all neighbours of current node
24+
# List of all neighbors of current node
2525
neighbors = edges[current]
2626

27-
# Traverse all neighbours of the current node
27+
# Traverse all neighbors of the current node
2828
for neighbor in neighbors:
29-
# Recursively visit each unvisited neighbour
29+
# Recursively visit each unvisited neighbor
3030
if neighbor not in visited:
3131
sort = topological_sort(neighbor, visited, sort)
3232

33-
# After visiting all neigbours, add the current node to the sorted list
33+
# After visiting all neigbors, add the current node to the sorted list
3434
sort.append(current)
3535

3636
# If there are some nodes that were not visited (disconnected components)

0 commit comments

Comments
 (0)