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

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

module Data.View

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 v Source #

a wrapper to inspect the given node

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

a wrapper to examine the given node

all of the graph's nodes

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 Int Source #

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

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 Bool Source #

whether two nodes are connected

dangling :: (View [Port] n, MonadReader (Graph n) m) => Port -> m Bool Source #

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.