Skip to content

Commit

Permalink
Merge pull request #2233 from regro/status-sort-again
Browse files Browse the repository at this point in the history
BUG make topological sort stable too
  • Loading branch information
beckermr authored Mar 5, 2024
2 parents 20f5217 + 36e51bd commit 5405180
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conda_forge_tick/path_lengths.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def cyclic_topological_sort(graph: DiGraph, sources: Iterable[T]) -> Sequence[T]

g2 = deepcopy(graph)
order: List[T] = []
for source in sources:
for source in sorted(sources):
_visit(g2, source, order)
return list(reversed(order))

Expand All @@ -45,7 +45,7 @@ def _visit(graph: DiGraph, node: T, order: List[T]) -> None:
if graph.nodes[node].get("visited", False):
return
graph.nodes[node]["visited"] = True
for n in graph.neighbors(node):
for n in sorted(graph.neighbors(node)):
_visit(graph, n, order)
order.append(node)

Expand Down

0 comments on commit 5405180

Please sign in to comment.