Representation of a directed graph. In Hakyll, this is used for dependency tracking.
- data DirectedGraph a
- fromList :: Ord a => [(a, Set a)] -> DirectedGraph a
- toList :: DirectedGraph a -> [(a, Set a)]
- member :: Ord a => a -> DirectedGraph a -> Bool
- nodes :: Ord a => DirectedGraph a -> Set a
- neighbours :: Ord a => a -> DirectedGraph a -> Set a
- reverse :: Ord a => DirectedGraph a -> DirectedGraph a
- reachableNodes :: Ord a => Set a -> DirectedGraph a -> Set a
- sanitize :: Ord a => DirectedGraph a -> DirectedGraph a
Documentation
data DirectedGraph a Source
Type used to represent a directed graph
Typeable1 DirectedGraph | |
Show a => Show (DirectedGraph a) | |
Ord a => Monoid (DirectedGraph a) | Allow users to concatenate different graphs |
(Ord a, Binary a) => Binary (DirectedGraph a) |
:: Ord a | |
=> [(a, Set a)] | List of (node, reachable neighbours) |
-> DirectedGraph a | Resulting directed graph |
Construction of directed graphs
toList :: DirectedGraph a -> [(a, Set a)]Source
Deconstruction of directed graphs
:: Ord a | |
=> a | Node to check for |
-> DirectedGraph a | Directed graph to check in |
-> Bool | If the node lies in the graph |
Check if a node lies in the given graph
:: Ord a | |
=> DirectedGraph a | Graph to get the nodes from |
-> Set a | All nodes in the graph |
Get all nodes in the graph
:: Ord a | |
=> a | Node to get the neighbours of |
-> DirectedGraph a | Graph to search in |
-> Set a | Set containing the neighbours |
Get a set of reachable neighbours from a directed graph
reverse :: Ord a => DirectedGraph a -> DirectedGraph aSource
Reverse a directed graph (i.e. flip all edges)
reachableNodes :: Ord a => Set a -> DirectedGraph a -> Set aSource
Find all reachable nodes from a given set of nodes in the directed graph
sanitize :: Ord a => DirectedGraph a -> DirectedGraph aSource
Remove all dangling pointers, i.e. references to notes that do not actually exist in the graph.