Safe Haskell | None |
---|

Enquiry of the graph structure. Note: In this module the term node is often used synonymously to node reference and node value. The two can easily distinguished by their type: the former has type `Node`

the latter usually `n`

.

- type WithGraph n = Reader (Graph n)
- readOnly :: WithGraph n a -> Rewrite n a
- readNode :: MonadReader (Graph n) m => Node -> m n
- inspectNode :: (View v n, MonadReader (Graph n) m) => Node -> m v
- examineNode :: (View v n, MonadReader (Graph n) m) => (v -> a) -> Node -> m a
- readNodeList :: MonadReader (Graph n) m => m [Node]
- readEdgeList :: MonadReader (Graph n) m => m [Edge]
- attachedEdges :: (View [Port] n, MonadReader (Graph n) m) => Node -> m [Edge]
- attachedNodes :: MonadReader (Graph n) m => Edge -> m [Node]
- edgeCardinality :: (View [Port] n, MonadReader (Graph n) m) => Edge -> m Int
- neighbours :: (View [Port] n, MonadReader (Graph n) m) => Node -> m [Node]
- relatives :: (View [Port] n, MonadReader (Graph n) m) => Node -> m [Node]
- adverseNodes :: MonadReader (Graph n) m => Node -> Port -> m [Node]
- connected :: (View [Port] n, MonadReader (Graph n) m) => Node -> Node -> m Bool
- free :: (View [Port] n, MonadReader (Graph n) m) => Port -> m Bool
- withNodes :: MonadReader (Graph n) m => (Node -> m a) -> m [a]
- module GraphRewriting.Graph.Types
- module Data.View

# Documentation

readOnly :: WithGraph n a -> Rewrite n aSource

This forces the use of the `Reader`

monad. Wrapping a sequence of monadic read-only operations (such as those defined below) into a read-only block can save much overhead e.g. in the state monad.

readNode :: MonadReader (Graph n) m => Node -> m nSource

inspectNode :: (View v n, MonadReader (Graph n) m) => Node -> m vSource

a wrapper to `inspect`

the given node

examineNode :: (View v n, MonadReader (Graph n) m) => (v -> a) -> Node -> m aSource

a wrapper to `examine`

the given node

readNodeList :: MonadReader (Graph n) m => m [Node]Source

all of the graph's nodes

readEdgeList :: MonadReader (Graph n) m => m [Edge]Source

all of the graph's edges

attachedEdges :: (View [Port] n, MonadReader (Graph n) m) => Node -> m [Edge]Source

edges attached to the given node

attachedNodes :: MonadReader (Graph n) m => Edge -> m [Node]Source

non-empty set of nodes attached to the given edge

edgeCardinality :: (View [Port] n, MonadReader (Graph n) m) => Edge -> m IntSource

amount of ports the given hyperedge is connected to

neighbours :: (View [Port] n, MonadReader (Graph n) m) => Node -> m [Node]Source

list of nodes that are connected to the given node, not including the node itself

relatives :: (View [Port] n, MonadReader (Graph n) m) => Node -> m [Node]Source

list of nodes that are connected to the given node, including the node itself

adverseNodes :: MonadReader (Graph n) m => Node -> Port -> m [Node]Source

nodes connected to given port of the specified node, not including the node itself

connected :: (View [Port] n, MonadReader (Graph n) m) => Node -> Node -> m BoolSource

whether two nodes are connected

free :: (View [Port] n, MonadReader (Graph n) m) => Port -> m BoolSource

whether the given ports features a dangling edge

withNodes :: MonadReader (Graph n) m => (Node -> m a) -> m [a]Source

Map node-relative enquiry over the nodes of the graph.

module GraphRewriting.Graph.Types

module Data.View