Data.Graph.Inductive.Monad

fgl-5.8.3.0: Martin Erwig's Functional Graph Library

Safe Haskell | Safe-Inferred
Language | Haskell98

Data.Graph.Inductive.Monad

Contents

- Classes
- Operations
  - Graph Folds and Maps
  - Graph Projection
  - Graph Construction and Destruction
  - Graph Inspection

Description

Monadic Graphs

Synopsis

- class Monad m => GraphM (m :: Type -> Type) (gr :: Type -> Type -> Type) where
  - emptyM :: m (gr a b)
  - isEmptyM :: m (gr a b) -> m Bool
  - matchM :: Node -> m (gr a b) -> m (Decomp gr a b)
  - mkGraphM :: [LNode a] -> [LEdge b] -> m (gr a b)
  - labNodesM :: m (gr a b) -> m [LNode a]
  - matchAnyM :: m (gr a b) -> m (GDecomp gr a b)
  - noNodesM :: m (gr a b) -> m Int
  - nodeRangeM :: m (gr a b) -> m (Node, Node)
  - labEdgesM :: m (gr a b) -> m [LEdge b]
- ufoldM :: GraphM m gr => (Context a b -> c -> c) -> c -> m (gr a b) -> m c
- nodesM :: GraphM m gr => m (gr a b) -> m [Node]
- edgesM :: GraphM m gr => m (gr a b) -> m [Edge]
- newNodesM :: GraphM m gr => Int -> m (gr a b) -> m [Node]
- delNodeM :: GraphM m gr => Node -> m (gr a b) -> m (gr a b)
- delNodesM :: GraphM m gr => [Node] -> m (gr a b) -> m (gr a b)
- mkUGraphM :: GraphM m gr => [Node] -> [Edge] -> m (gr () ())
- contextM :: GraphM m gr => m (gr a b) -> Node -> m (Context a b)
- labM :: GraphM m gr => m (gr a b) -> Node -> m (Maybe a)

# Classes

class Monad m => GraphM (m :: Type -> Type) (gr :: Type -> Type -> Type) where #

Minimal complete definition

emptyM, isEmptyM, matchM, mkGraphM, labNodesM

Methods

emptyM :: m (gr a b) #

isEmptyM :: m (gr a b) -> m Bool #

matchM :: Node -> m (gr a b) -> m (Decomp gr a b) #

mkGraphM :: [LNode a] -> [LEdge b] -> m (gr a b) #

labNodesM :: m (gr a b) -> m [LNode a] #

matchAnyM :: m (gr a b) -> m (GDecomp gr a b) #

noNodesM :: m (gr a b) -> m Int #

nodeRangeM :: m (gr a b) -> m (Node, Node) #

labEdgesM :: m (gr a b) -> m [LEdge b] #

#### Instances

Instances details

GraphM IO SGr # |
Instance details Defined in Data.Graph.Inductive.Monad.IOArray Methods emptyM :: IO (SGr a b) # isEmptyM :: IO (SGr a b) -> IO Bool # matchM :: Node -> IO (SGr a b) -> IO (Decomp SGr a b) # mkGraphM :: [LNode a] -> [LEdge b] -> IO (SGr a b) # labNodesM :: IO (SGr a b) -> IO [LNode a] # matchAnyM :: IO (SGr a b) -> IO (GDecomp SGr a b) # noNodesM :: IO (SGr a b) -> IO Int # nodeRangeM :: IO (SGr a b) -> IO (Node, Node) # labEdgesM :: IO (SGr a b) -> IO [LEdge b] #
GraphM (ST s) (SGr s) # |
Instance details Defined in Data.Graph.Inductive.Monad.STArray Methods emptyM :: ST s (SGr s a b) # isEmptyM :: ST s (SGr s a b) -> ST s Bool # matchM :: Node -> ST s (SGr s a b) -> ST s (Decomp (SGr s) a b) # mkGraphM :: [LNode a] -> [LEdge b] -> ST s (SGr s a b) # labNodesM :: ST s (SGr s a b) -> ST s [LNode a] # matchAnyM :: ST s (SGr s a b) -> ST s (GDecomp (SGr s) a b) # noNodesM :: ST s (SGr s a b) -> ST s Int # nodeRangeM :: ST s (SGr s a b) -> ST s (Node, Node) # labEdgesM :: ST s (SGr s a b) -> ST s [LEdge b] #

# Operations

## Graph Folds and Maps

ufoldM :: GraphM m gr => (Context a b -> c -> c) -> c -> m (gr a b) -> m c #

graph fold

## Graph Projection

nodesM :: GraphM m gr => m (gr a b) -> m [Node] #

edgesM :: GraphM m gr => m (gr a b) -> m [Edge] #

newNodesM :: GraphM m gr => Int -> m (gr a b) -> m [Node] #

## Graph Construction and Destruction

delNodeM :: GraphM m gr => Node -> m (gr a b) -> m (gr a b) #

delNodesM :: GraphM m gr => [Node] -> m (gr a b) -> m (gr a b) #

mkUGraphM :: GraphM m gr => [Node] -> [Edge] -> m (gr () ()) #

## Graph Inspection

contextM :: GraphM m gr => m (gr a b) -> Node -> m (Context a b) #

labM :: GraphM m gr => m (gr a b) -> Node -> m (Maybe a) #