Module DaVinci.curry

Binding for the daVinci graph visualization tool.

This library supports the visualization of graphs by the daVinci graph drawing tool through the following features:

  • Graphs are displayed by the main functions dvDisplay or dvDisplayInit
  • Graphs to be displayed are constructed by the functions:
    dvNewGraph: takes a list of nodes to construct a graph
    dvSimpleNode: a node without outgoing edges
    dvNodeWithEdges: a node with a list of outgoing edges
    dvSimpleEdge: an edge to a particular node
    The constructors dvSimpleNode/dvNodeWithEdges/dvSimpleEdge have a graph identifier (type DvId) as a first argument. This identifier is a free variable (since type DvId is abstract) and can be used in other functions to refer to this node or edge.
  • The constructor functions for graph entities take an event handler (of type "DvWindow -> Success") as the last argument. This event handler is executed whenever the user clicks on the corresponding graph entity.
  • There are a number of predefined event handlers to manipulate existing graphs (see functions dvSetNodeColor, dvAddNode, dvSetEdgeColor, dvAddEdge, dvDelEdge, dvSetClickHandler). dvEmptyH is the "empty handler" which does nothing.

For a correct installation of this library, the constant dvStartCmd defined below must be correctly set to start your local installation of DaVinci.

Author: Johannes Koj (with modifications by Michael Hanus)

Version: August 2003

Summary of exported operations:

dvDisplay :: DvGraph -> IO ()   
Displays a graph with daVinci and run the scheduler for handling events.
dvDisplayInit :: DvGraph -> (Port DvScheduleMsg -> Success) -> IO ()   
Displays a graph with daVinci and run the scheduler for handling events after performing some initialization events.
dvNewGraph :: [DvNode] -> DvGraph   
Constructs a new graph from a list of nodes.
dvSimpleNode :: DvId -> String -> (Port DvScheduleMsg -> Success) -> DvNode   
A node without outgoing edges.
dvNodeWithEdges :: DvId -> String -> [DvEdge] -> (Port DvScheduleMsg -> Success) -> DvNode   
A node with a list of outgoing edges.
dvSimpleEdge :: DvId -> DvId -> (Port DvScheduleMsg -> Success) -> DvEdge   
An edge to a particular node.
dvSetNodeColor :: DvId -> String -> Port DvScheduleMsg -> Success   
An event handler that sets the color (second argument) of a node.
dvAddNode :: DvId -> String -> (Port DvScheduleMsg -> Success) -> Port DvScheduleMsg -> Success   
An event handler that adds a new node to the graph.
dvSetEdgeColor :: DvId -> String -> Port DvScheduleMsg -> Success   
An event handler that sets the color (second argument) of an edge.
dvAddEdge :: DvId -> DvId -> DvId -> (Port DvScheduleMsg -> Success) -> Port DvScheduleMsg -> Success   
An event handler that adds a new edge to the graph.
dvDelEdge :: DvId -> Port DvScheduleMsg -> Success   
An event handler that deletes an existing edge from the graph.
dvSetClickHandler :: DvId -> (Port DvScheduleMsg -> Success) -> Port DvScheduleMsg -> Success   
An event handler that changes the event handler of a node or edge.
dvEmptyH :: Port DvScheduleMsg -> Success   
The "empty" event handler.

Exported datatypes:


DvWindow

Type synonym: DvWindow = Port DvScheduleMsg


DvId

The abstract datatype for identifying nodes in a graph. Used by the various functions to create and manipulate graphs.

Constructors:


DvGraph

The abstract datatype for graphs represented by daVinci. Such graphs are constructed from a list of nodes by the function dvNewGraph.

Constructors:


DvNode

The abstract datatype for nodes in a graph represented by daVinci. Nodes are constructed by the functions dvSimpleNode and dvNodeWithEdges.

Constructors:


DvEdge

The abstract datatype for edges in a graph represented by daVinci. Edges are constructed by the function dvSimpleEdge.

Constructors:


DvScheduleMsg

The abstract datatype for communicating with the daVinci visualization tool. The constructors of this datatype are not important since all communications are wrapped in this library. The only relevant point is that Port DvScheduleMsg -> Success is the type of an event handler that can manipulate a graph visualized by daVinci (see dvSetNodeColor, dvAddNode etc).

Constructors:


Exported operations:

dvDisplay :: DvGraph -> IO ()   

Displays a graph with daVinci and run the scheduler for handling events.

Further infos:
  • might behave indeterministically

dvDisplayInit :: DvGraph -> (Port DvScheduleMsg -> Success) -> IO ()   

Displays a graph with daVinci and run the scheduler for handling events after performing some initialization events.

Further infos:
  • might behave indeterministically

dvNewGraph :: [DvNode] -> DvGraph   

Constructs a new graph from a list of nodes.

Further infos:
  • solution complete, i.e., able to compute all solutions

dvSimpleNode :: DvId -> String -> (Port DvScheduleMsg -> Success) -> DvNode   

A node without outgoing edges.

Example call: (dvSimpleNode node label clickH)

Parameters:
node : a graph identifier (usually: a free variable)
label : a label written at this node
clickH : an event hander to be executed whenver the user clicks on this node
Returns:
a new graph node
Further infos:
  • solution complete, i.e., able to compute all solutions

dvNodeWithEdges :: DvId -> String -> [DvEdge] -> (Port DvScheduleMsg -> Success) -> DvNode   

A node with a list of outgoing edges.

Example call: (dvNodeWithEdges node label edges clickH)

Parameters:
node : a graph identifier (usually: a free variable)
label : a label written at this node
edges : a list of outgoing edges
clickH : an event hander to be executed whenver the user clicks on this node
Returns:
a new graph node
Further infos:
  • solution complete, i.e., able to compute all solutions

dvSimpleEdge :: DvId -> DvId -> (Port DvScheduleMsg -> Success) -> DvEdge   

An edge to a particular node.

Example call: (dvSimpleEdge edge node clickH)

Parameters:
edge : a graph identifier for this edge (usually: a free variable)
node : a graph identifier of the target node
clickH : an event hander to be executed whenver the user clicks on this edge
Returns:
a new graph edge

dvSetNodeColor :: DvId -> String -> Port DvScheduleMsg -> Success   

An event handler that sets the color (second argument) of a node.

Further infos:
  • might behave indeterministically

dvAddNode :: DvId -> String -> (Port DvScheduleMsg -> Success) -> Port DvScheduleMsg -> Success   

An event handler that adds a new node to the graph.

Further infos:
  • might behave indeterministically

dvSetEdgeColor :: DvId -> String -> Port DvScheduleMsg -> Success   

An event handler that sets the color (second argument) of an edge.

Further infos:
  • might behave indeterministically

dvAddEdge :: DvId -> DvId -> DvId -> (Port DvScheduleMsg -> Success) -> Port DvScheduleMsg -> Success   

An event handler that adds a new edge to the graph.

Further infos:
  • might behave indeterministically

dvDelEdge :: DvId -> Port DvScheduleMsg -> Success   

An event handler that deletes an existing edge from the graph.

Further infos:
  • might behave indeterministically

dvSetClickHandler :: DvId -> (Port DvScheduleMsg -> Success) -> Port DvScheduleMsg -> Success   

An event handler that changes the event handler of a node or edge.

Further infos:
  • might behave indeterministically

dvEmptyH :: Port DvScheduleMsg -> Success   

The "empty" event handler.

Further infos:
  • solution complete, i.e., able to compute all solutions