graph-rewriting-0.8.0: Monadic graph rewriting of hypergraphs with ports and multiedges
Safe HaskellSafe-Inferred
LanguageHaskell2010

GraphRewriting.Graph

Description

Most of the functions for graph scrutinisation (Read) and modification (Write) are defined monadically. This module defines functions for extracting these monadic values and a few non-monadic graph scrutinisation/modification functions.

Synopsis

Documentation

nodes :: Graph n -> [n] Source #

edges :: Graph n -> [(Edge, [n])] Source #

Each edge corresponds to the set of nodes it connects

unsafeMapNodes :: (n -> n') -> Graph n -> Graph n' Source #

unsafe, since no checks are performed to ensure that the invariants from GraphRewriting.Graph.Write are preserved

unsafeMapNodesUnique :: (Int -> n -> n') -> Graph n -> Graph n' Source #

map that supplies an additional unique key to the mapping function; unsafe in the same way as unsafeMapNodes

runGraph :: Rewrite n a -> Graph n -> (a, Graph n) Source #

apply a monadic graph modification to a graph

evalGraph :: Rewrite n a -> Graph n -> a Source #

execGraph :: Rewrite n a -> Graph n -> Graph n Source #

data Graph n Source #

Hypergraph that holds nodes of type n. Nodes can be referenced by type Node, edges by type Port, see GraphRewriting.Graph.Read and GraphRewriting.Graph.Write

Constructors

Graph 

Instances

Instances details
MonadReader (Graph n) (Rewrite n) Source # 
Instance details

Defined in GraphRewriting.Graph.Internal

Methods

ask :: Rewrite n (Graph n) #

local :: (Graph n -> Graph n) -> Rewrite n a -> Rewrite n a #

reader :: (Graph n -> a) -> Rewrite n a #

MonadState (Graph n) (Rewrite n) Source # 
Instance details

Defined in GraphRewriting.Graph.Internal

Methods

get :: Rewrite n (Graph n) #

put :: Graph n -> Rewrite n () #

state :: (Graph n -> (a, Graph n)) -> Rewrite n a #