graph-rewriting-0.6.0: Monadic graph rewriting of hypergraphs with ports and multiedges

Safe HaskellNone

GraphRewriting.Graph.Read

Description

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.

Synopsis

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.

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 Data.View