iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Graph.Sparse.TopSort

Synopsis

Documentation

topSort :: SparseGraph w -> Maybe (Vector Int) Source #

>>> topSort $ buildDirectedGraph 4 4 $ U.fromList [(0,1),(0,2),(1,3),(2,3)]
Just [0,1,2,3]
>>> topSort $ buildDirectedGraph 2 0 U.empty
Just [0,1]
>>> topSort $ buildDirectedGraph 2 2 $ U.fromList [(0,1),(1,0)]
Nothing