HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

ModuleAgda-2.8.0.2Haskell2010

Agda.Utils.Graph.TopSort

  • 1 value
  • PackageAgda-2.8.0.2
  • Exports1
  • LanguageHaskell2010
  • LicenceMIT
  • SourceTopSort.hs
valuetopSort :: Ord n => Set n -> [(n, n)] -> Maybe [n]
#

topoligical sort with smallest-numbered available vertex first | input: nodes, edges | output is Nothing if the graph is not a DAG Note: should be stable to preserve order of generalizable variables. Algorithm due to Richard Eisenberg, and works by walking over the list left-to-right and moving each node the minimum distance left to guarantee topological ordering.