Safe Haskell | None |
---|
Data.Graph.Algorithms.Basic
- grev :: (InspectableGraph gr, MutableGraph gr, VertexListGraph gr) => gr -> gr
- undir :: (Eq (EdgeLabel gr), InspectableGraph gr, MutableGraph gr, VertexListGraph gr) => gr -> gr
- unlab :: forall gr1 gr2. (VertexListGraph gr1, InspectableGraph gr1, MutableGraph gr2, VertexLabel gr1 ~ VertexLabel gr2, EdgeLabel gr2 ~ ()) => gr1 -> gr2
- gsel :: (VertexListGraph gr, InspectableGraph gr) => (Context gr -> Bool) -> gr -> [Context gr]
- efilter :: (MutableGraph gr, InspectableGraph gr, VertexListGraph gr) => (Edge gr -> Bool) -> gr -> gr
- elfilter :: (MutableGraph gr, InspectableGraph gr, VertexListGraph gr) => (EdgeLabel gr -> Bool) -> gr -> gr
- hasLoop :: (VertexListGraph gr, InspectableGraph gr) => gr -> Bool
- isSimple :: (VertexListGraph gr, InspectableGraph gr) => gr -> Bool
- postorder :: Tree a -> [a]
- postorderF :: [Tree a] -> [a]
- preorder :: Tree a -> [a]
- preorderF :: [Tree a] -> [a]
Basic graph operations
grev :: (InspectableGraph gr, MutableGraph gr, VertexListGraph gr) => gr -> gr
Reverse the directions of all of the edges in the graph
undir :: (Eq (EdgeLabel gr), InspectableGraph gr, MutableGraph gr, VertexListGraph gr) => gr -> gr
Make the graph undirected. For every edge (A->B)_L (edge from A to B with label L), make a new edge (B->A)_L.
unlab :: forall gr1 gr2. (VertexListGraph gr1, InspectableGraph gr1, MutableGraph gr2, VertexLabel gr1 ~ VertexLabel gr2, EdgeLabel gr2 ~ ()) => gr1 -> gr2
Remove the labels from edges. This may result in duplicate edges; the resolution of those edges depends on the underlying graph implementation (i.e., whether or not multi-edges are permitted).
Arguments
:: (VertexListGraph gr, InspectableGraph gr) | |
=> (Context gr -> Bool) | The predicate |
-> gr | The graph |
-> [Context gr] |
Return all of the contexts for which the predicate evaluates to True
Filtering operations
Arguments
:: (MutableGraph gr, InspectableGraph gr, VertexListGraph gr) | |
=> (Edge gr -> Bool) | Edge condition |
-> gr | Input graph |
-> gr |
Filter edges from the graph, keeping those that meet the condition
Arguments
:: (MutableGraph gr, InspectableGraph gr, VertexListGraph gr) | |
=> (EdgeLabel gr -> Bool) | Edge label condition |
-> gr | Input graph |
-> gr |
Filter edges from the graph based on just the edge label
Simple predicates
hasLoop :: (VertexListGraph gr, InspectableGraph gr) => gr -> Bool
Test to see if the graph has a self loop on any vertex
isSimple :: (VertexListGraph gr, InspectableGraph gr) => gr -> Bool
Inverse of hasLoop
Tree operations
postorderF :: [Tree a] -> [a]