Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
mutualGroups :: (Ord r, Show r, Foldable t) => (a -> Maybe r) -> Map r (t a) -> [[r]] Source #
Return the groups of entities that are mutually dependent
>>>
mutualGroups Just (M.fromList [("a",["b","c"]),("b",["a","c"]),("c",[])])
[["c"],["a","b"]]
transitiveClosure :: (Ord r, Show r, Foldable t) => (a -> Maybe r) -> Map r (t a) -> r -> Either Errors [r] Source #
Return the transitive closure of an element in a graph of dependencies specified as an adjacency list
>>>
transitiveClosure Just (M.fromList [("a",["b","c"]),("b",["b","d","d","c"]),("c",[]),("d",["a"])]) "b"
Right ["c","a","d","b"]