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

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

module Data.View

readOnly :: MonadReader (Graph n) m => Reader (Graph n) a -> m a Source #

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, MonadFail m) => Node -> m n Source #

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

a wrapper to inspect the given node

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

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, MonadFail m) => Node -> m [Edge] Source #

edges attached to the given node

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

non-empty set of nodes attached to the given edge

edgeCardinality :: (View [Port] n, MonadReader (Graph n) m, MonadFail m) => Edge -> m Int Source #

amount of ports the given hyperedge is connected to

neighbours :: (View [Port] n, MonadReader (Graph n) m, MonadFail 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, MonadFail m) => Node -> m [Node] Source #

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

adverseNodes :: (MonadReader (Graph n) m, MonadFail 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, MonadFail m) => Node -> Node -> m Bool Source #

whether two nodes are connected

dangling :: (View [Port] n, MonadReader (Graph n) m, MonadFail 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.