ajhc-0.8.0.7: Haskell compiler that produce binary through C language

Safe HaskellNone

Util.Graph

Description

Data.Graph is sorely lacking in several ways, This just tries to fill in some holes and provide a more convinient interface

Synopsis

Documentation

data Graph n Source

Instances

fromGraph :: Graph n -> [(n, [n])]Source

newGraph :: Ord k => [n] -> (n -> k) -> (n -> [k]) -> Graph nSource

newGraph' :: Ord k => [n] -> (n -> k) -> (n -> [k]) -> (Map k Vertex, Graph n)Source

Build a graph from a list of nodes uniquely identified by keys, with a list of keys of nodes this node should have edges to. The out-list may contain keys that don't correspond to nodes of the graph; they are ignored.

newGraphReachable :: Ord k => [n] -> (n -> k) -> (n -> [k]) -> ([k] -> [n], Graph n)Source

reachableFrom :: Ord k => (n -> k) -> (n -> [k]) -> [n] -> [k] -> [n]Source

reachable :: Graph n -> [Vertex] -> [n]Source

fromScc :: Either t [t] -> [t]Source

findLoopBreakersSource

Arguments

:: (n -> Int)

fitness function, greater numbers mean more likely to be a loopbreaker

-> (n -> Bool)

whether a node is suitable at all for a choice as loopbreaker

-> Graph n

the graph

-> ([n], [n])

(loop breakers,dependency ordered nodes after loopbreaking)

determine a set of loopbreakers subject to a fitness function loopbreakers have a minimum of their incoming edges ignored.

sccGroups :: Graph n -> [[n]]Source

scc :: Graph n -> [Either n [n]]Source

components :: Graph n -> [[n]]Source

topSort :: Graph n -> [n]Source

toDag :: Graph n -> Graph [n]Source

restitchGraph :: Ord k => (n -> k) -> (n -> [k]) -> Graph n -> Graph nSource

mapGraph :: forall a b. (a -> [b] -> b) -> Graph a -> Graph bSource