Functions for modifying the graph. Although the graph structure is entirely expressed by the graph's node collection, for better convenience and efficiency the graph representation also comprises a complementary node set, that has to be synchronised with the node collection. Therefore each of the functions below involves a test for whether the graph structure has been changed, and if so, measures are taken to ensure the graph remains consistent.

- writeNode :: View [Port] n => Node -> n -> Rewrite n ()
- modifyNode :: View [Port] n => Node -> (n -> n) -> Rewrite n ()
- updateNode :: (View [Port] n, View v n) => Node -> v -> Rewrite n ()
- adjustNode :: (View [Port] n, View v n) => Node -> (v -> v) -> Rewrite n ()
- adjustNodeM :: (View [Port] n, View v n) => Node -> (v -> Rewrite n v) -> Rewrite n ()
- newNode :: View [Port] n => n -> Rewrite n Node
- copyNode :: (View [Port] n, View v n) => Node -> v -> Rewrite n Node
- newEdge :: Rewrite n Edge
- deleteNode :: View [Port] n => Node -> Rewrite n ()
- deleteEdge :: View [Port] n => Edge -> Rewrite n [Edge]
- mergeEdges :: View [Port] n => Edge -> Edge -> Rewrite n ()
- module GraphRewriting.Graph.Types
- module Data.View

# Documentation

updateNode :: (View [Port] n, View v n) => Node -> v -> Rewrite n ()Source

Wraps `update`

to update aspect `v`

of a node.

adjustNode :: (View [Port] n, View v n) => Node -> (v -> v) -> Rewrite n ()Source

Wraps `adjust`

to adjust aspect `v`

of a node.

copyNode :: (View [Port] n, View v n) => Node -> v -> Rewrite n NodeSource

Create a new node by cloning another, at the same time updating aspect `v`

. When defining rewrites in a context where it is not known what type `n`

the nodes of the graph have, this is the only way to add new nodes to the graph.

newEdge :: Rewrite n EdgeSource

Create a new (unconnected) edge. It is expected that the created edge is connected to a port sooner or later. Otherwise the graph will invove unconnected edges.

deleteEdge :: View [Port] n => Edge -> Rewrite n [Edge]Source

Disconnect ports connected to the given edge by assigning a new (dangling) edge to each of the ports. Then the edge is deleted.

mergeEdges :: View [Port] n => Edge -> Edge -> Rewrite n ()Source

Reconnects the ports connected to the second edge to the first one. Then the second edge is deleted.

module GraphRewriting.Graph.Types

module Data.View