Module Avl_draw


module Avl_draw: sig  end
Drawing graphs.

This module allows drawing a graphical representation of directed graphs. Arbitrary output devices may be used, e.g. the Objective Caml graphics library. Arrangements of nodes and edges are computed thanks to the GraphViz tools.




Drawing attributes

This sections defines datatype for specifying the drawing attributes of the nodes and edges of a graph.


type color = int

Colors are represented by integers, using the same encoding than that of the Objective Caml graphics library.


type point = int * int
Coordinates of point are given by a pair of integers.



Nodes attributes



type node_attributes = {
   nd_label : [ `None | `Text of text_label_attributes]; (*Sets the label to be drawed inside the node. Two options are currently implemented:
  • `None : no label,
  • `Text att : textual label, described by att.
*)
   nd_shape : [ `Box | `Circle | `Ellipse | `Square]; (*Sets the shape of the border of the node. Available shapes are `Box (rectangle), `Square, `Circle and `Ellipse.*)
   nd_size : [ `FitLabel of int * int | `Fixed of int * int]; (*Sets the the size of the label. Two options are available:
  • `FitLabel (hm, vm): the shape will fit the label, with horizontal and vertical margin of hm and vm pixels, respectively.
  • `Fixed (w, h): the label will fit a rectangle of witdth w and height h pixels.
*)
   nd_border : [ `NoBorder | `Solid of color * int]; (*Sets the style of the border. Available styles are:
  • `NoBorder: no border will be drawn.
  • `Solid (c, w): a solid border will be drawn with color c and width w.
*)
   nd_background : [ `Solid of color | `Transparent]; (*Sets the style of the background of the node. Available styles are:
  • `Transparent: no background.
  • `Solid c: the node will be filled with color c.
*)
}
The drawing attributes of a node are specified by a record of type 'a node_attributes.


type text_label_attributes = {
   tl_text : string; (*The litteral text of the label.*)
   tl_fontname : string; (*The family font name. If the string is empty, default system font will be kept.*)
   tl_fontsize : int; (*The font size.*)
   tl_color : color; (*The font color.*)
}
The attributes of a text label are specified by a record of type text_label_attributes.

val default_node : node_attributes
default_node is a standard record of node attributes.
val default_label : text_label_attributes
default_text_label is a standard record of text label attributes.


Edges attributes



type edge_attributes = {
   ed_linestyle : [ `Solid of color * int | `Transparent]; (*Sets the drawing style of the edge line. Available options are:
  • `Transparent: no line will be traced.
  • `Solid (c, w): a solid line will be drawn with color c and width w.
*)
   ed_originarrow : arrow_style; (*The style of the origin arrow.*)
   ed_tailarrow : arrow_style; (*The style of the tail arrow.*)
}
The drawing attributes of an edge are specified by a record of type edge_attributes.


type arrow_style = [ `Filled of int * float * color
| `Lined of int * float * color * int
| `None]
Available arrows styles:

val default_edge : edge_attributes
default_edge is a standard record of edge attributes.


Client's signatures


module type GRAPH = sig  end
The client must provide an implementation of graphs which fullfills the signature GRAPH.
module type DRAW = sig  end
The client must provide drawing functions which fullfills the signature DRAW.
module DrawGraphics: DRAW
DrawGraphics provides an implementation of signature DRAW for the graphics library of Objective Caml.


Make functor


module Make: functor (D : DRAW) -> functor (G : GRAPH) -> sig  end
Given an implementation of drawing capabilities and of graphs structures, the functor Make provide drawing functions for graphs.
module MakeGraphics: functor (G : GRAPH) -> sig  end
Given an implementation of graphs structures, the functor MakeGraphics provides drawing functions for the Objective Caml graphics library.