Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.Tools.Sorting
Description
Utilities for sorting
Synopsis
- topologicalSort :: Ord a => [(a, [a])] -> Either [[a]] [a]
- topologicalSortComponents :: Ord a => [(a, [a])] -> [[a]]
- initGraph :: Ord a => [(a, [a])] -> (Graph, Vertex -> ((), a, [a]))
Documentation
topologicalSort :: Ord a => [(a, [a])] -> Either [[a]] [a] Source #
Sort a directed acyclic graph (DAG) based on an adjacency list Yields a list of nontrivial strongly connected components if the graph has cycles
topologicalSortComponents :: Ord a => [(a, [a])] -> [[a]] Source #
Find the strongly connected components (including cycles and isolated vertices) of a graph, in (reverse) topological order