Skip to content

Commit

Permalink
use find_cycles in contains_cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Dec 12, 2022
1 parent 27255a5 commit 29775e6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pytools/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,7 @@ def contains_cycle(graph: GraphT) -> bool:
.. versionadded:: 2020.2
"""

try:
compute_topological_order(graph, verbose_cycle=False)
return False
except CycleError:
return True
return bool(find_cycles(graph))

# }}}

Expand Down

0 comments on commit 29775e6

Please sign in to comment.