ghc-7.6.3: The GHC API

Safe Haskell | None

Digraph

Synopsis

- data Graph node
- graphFromVerticesAndAdjacency :: Ord key => [(node, key)] -> [(key, key)] -> Graph (node, key)
- graphFromEdgedVertices :: Ord key => [Node key payload] -> Graph (Node key payload)
- data SCC vertex
  - = AcyclicSCC vertex
  - | CyclicSCC [vertex]
- type Node key payload = (payload, key, [key])
- flattenSCC :: SCC a -> [a]
- flattenSCCs :: [SCC a] -> [a]
- stronglyConnCompG :: Graph node -> [SCC node]
- topologicalSortG :: Graph node -> [node]
- dfsTopSortG :: Graph node -> [[node]]
- verticesG :: Graph node -> [node]
- edgesG :: Graph node -> [Edge node]
- hasVertexG :: Graph node -> node -> Bool
- reachableG :: Graph node -> node -> [node]
- transposeG :: Graph node -> Graph node
- outdegreeG :: Graph node -> node -> Maybe Int
- indegreeG :: Graph node -> node -> Maybe Int
- vertexGroupsG :: Graph node -> [[node]]
- emptyG :: Graph node -> Bool
- componentsG :: Graph node -> [[node]]
- findCycle :: forall payload key. Ord key => [Node key payload] -> Maybe [payload]
- stronglyConnCompFromEdgedVertices :: Ord key => [Node key payload] -> [SCC payload]
- stronglyConnCompFromEdgedVerticesR :: Ord key => [Node key payload] -> [SCC (Node key payload)]
- tabulate :: Bounds -> [Vertex] -> Table Int
- preArr :: Bounds -> Forest Vertex -> Table Int
- components :: IntGraph -> Forest Vertex
- undirected :: IntGraph -> IntGraph
- back :: IntGraph -> Table Int -> IntGraph
- cross :: IntGraph -> Table Int -> Table Int -> IntGraph
- forward :: IntGraph -> IntGraph -> Table Int -> IntGraph
- path :: IntGraph -> Vertex -> Vertex -> Bool
- bcc :: IntGraph -> Forest [Vertex]
- do_label :: IntGraph -> Table Int -> Tree Vertex -> Tree (Vertex, Int, Int)
- bicomps :: Tree (Vertex, Int, Int) -> Forest [Vertex]
- collect :: Tree (Vertex, Int, Int) -> (Int, Tree [Vertex])

# Documentation

data Graph node

Instances

Outputable node => Outputable (Graph node) |

graphFromVerticesAndAdjacency :: Ord key => [(node, key)] -> [(key, key)] -> Graph (node, key)

graphFromEdgedVertices :: Ord key => [Node key payload] -> Graph (Node key payload)

data SCC vertex

Constructors

AcyclicSCC vertex |
CyclicSCC [vertex] |

Instances

Functor SCC |
Outputable a => Outputable (SCC a) |

type Node key payload = (payload, key, [key])

flattenSCC :: SCC a -> [a]

flattenSCCs :: [SCC a] -> [a]

stronglyConnCompG :: Graph node -> [SCC node]

topologicalSortG :: Graph node -> [node]

dfsTopSortG :: Graph node -> [[node]]

verticesG :: Graph node -> [node]

edgesG :: Graph node -> [Edge node]

hasVertexG :: Graph node -> node -> Bool

reachableG :: Graph node -> node -> [node]

transposeG :: Graph node -> Graph node

outdegreeG :: Graph node -> node -> Maybe Int

indegreeG :: Graph node -> node -> Maybe Int

vertexGroupsG :: Graph node -> [[node]]

emptyG :: Graph node -> Bool

componentsG :: Graph node -> [[node]]

findCycle :: forall payload key. Ord key => [Node key payload] -> Maybe [payload]

Find a reasonably short cycle a->b->c->a, in a strongly connected component. The input nodes are presumed to be a SCC, so you can start anywhere.

stronglyConnCompFromEdgedVertices :: Ord key => [Node key payload] -> [SCC payload]

stronglyConnCompFromEdgedVerticesR :: Ord key => [Node key payload] -> [SCC (Node key payload)]

tabulate :: Bounds -> [Vertex] -> Table Int

preArr :: Bounds -> Forest Vertex -> Table Int

components :: IntGraph -> Forest Vertex

undirected :: IntGraph -> IntGraph

back :: IntGraph -> Table Int -> IntGraph

cross :: IntGraph -> Table Int -> Table Int -> IntGraph

forward :: IntGraph -> IntGraph -> Table Int -> IntGraph

path :: IntGraph -> Vertex -> Vertex -> Bool

bcc :: IntGraph -> Forest [Vertex]

do_label :: IntGraph -> Table Int -> Tree Vertex -> Tree (Vertex, Int, Int)

bicomps :: Tree (Vertex, Int, Int) -> Forest [Vertex]

collect :: Tree (Vertex, Int, Int) -> (Int, Tree [Vertex])