graph-rewriting-gl-0.6.7: OpenGL interface for interactive port graph rewriting



This module provides an easy-to-use interface to create an interactive, graphical front-end for you graph rewriting system. The controls of the GUI are as follows:

  • Left-click on a menu entry to select a rewriting rule. At all times all redexes with respect to the selected rule are marked red in the graph. Note that the menu is hierarchical, which means that selecting a rule that has subordinate entries has the effect of all these entries being selected.
  • Right-click on a menu entry to apply the corresponding rule at every applicable position in the graph simultaneously (in no particular order). Redexes that are destroyed (or created) by prior contractions in this process are not reduced, thus if single applications of the rule terminate, so does its simultaneous application. Right-clicking does not select the rule.
  • Right-click on a node of the graph to apply the selected rewriting rule at that position. You know before whether it is a applicable, since all redexes in the graph with respect to the selected rule are marked red. Right-clicking on a non-redexs node has no effect. The layouting stops while the right mouse-button is pressed.
  • Drag the background of the canvas to scroll around.
  • Drag individual nodes of the graph around to manually change the layouting of the graph.
  • Use your mouse-wheel to zoom in/out. Make sure to keep the mouse curser in the canvas area and not the menu while zooming.
  • Press space to pause/resume layouting. Currently layouting is automatically resumed when the graph is rewritten by right-clicking on an individual node and not when right-clicking on a menu entry. This also requires the mouse cursor to be positioned in the canvas area.

Please have a look the graph-rewriting-ski package for an example application that makes use of this library.



initialise :: IO (String, [String])Source

Initialises GLUT. Returns program name and command line arguments.



:: (View Position n, Render n', View Position n', View Rotation n', PortSpec n', View [Port] n') 
=> Int

The number of initial layout steps to apply before displaying the graph

-> (Graph n -> Graph n')

A projection function that is applied just before displaying the graph

-> (Node -> Rewrite n a)

The monadic graph transformation code for a layout step

-> Graph n 
-> LabeledTree (Rule n)

The rule menu given as a tree of named rules

-> IO ()