- type Graph = Map Name [Edge]
- type Edge = (Name, Bool)
- graphOfBinds :: [(Name, ExpF)] -> [Name] -> Graph
- graphTopoOrder :: Graph -> [Name]
- mergeWeights :: Graph -> Map Name Int -> Graph
- traversal :: Graph -> (Edge -> Name -> Int) -> Map Name Int
- invertMap :: (Ord k, Ord v) => Map k v -> Map v [k]
- mlookup :: Ord k => String -> Map k v -> k -> v
Graph for function Each node is a binding, edges are dependencies, and the bool is whether the node's output can be fused or contracted. For example, filter and map dependencies can be contracted, but a fold cannot as it must consume the entire stream before producing output.
Find topological ordering of DAG Does not check for cycles - really must be a DAG!