Module Graphviz

module Graphviz: sig .. end

Interface with GraphViz

This module provides a basic interface with dot and neato, two programs of the GraphViz toolbox. These tools are available at the following URLs:


Common stuff

Because the neato and dot engines present a lot of common points - in particular in the graph description language, large parts of the code is shared. The CommonAttributes module defines attributes of graphs, vertices and edges that are understood by the two engines. Then module DotAttributes and NeatoAttributes define attributes specific to dot and neato respectively.

Common types and signatures

type color = int 
type color_with_transparency = int32 

The two least significant bytes encode the transparency information; the six most signification are the standard RGB color

val color_to_color_with_transparency : color -> color_with_transparency
type arrow_style = [ `Dot | `Inv | `Invdot | `Invodot | `None | `Normal | `Odot ] 
module type ATTRIBUTES = sig .. end

The ATTRIBUTES module type defines the interface for the engines.

Common attributes

module CommonAttributes: sig .. end

The CommonAttributes module defines attributes for graphs, vertices and edges that are available in the two engines, dot and neato.

Interface with the dot engine

module DotAttributes: sig .. end

DotAttributes extends CommonAttributes and implements ATTRIBUTES.

module type GraphWithDotAttrs = sig .. end

Graph module with dot attributes

module Dot: 
functor (X : sig

Graph implementation. Sub-signature of Sig.G

type t 
module V: sig .. end
module E: sig .. end
val iter_vertex : (V.t -> unit) -> t -> unit
val iter_edges_e : (E.t -> unit) -> t -> unit

Graph, vertex and edge attributes.

val graph_attributes : t -> Graphviz.DotAttributes.graph list
val default_vertex_attributes : t -> Graphviz.DotAttributes.vertex list
val vertex_name : V.t -> string
val vertex_attributes : V.t -> Graphviz.DotAttributes.vertex list
val get_subgraph : V.t -> Graphviz.DotAttributes.subgraph option

The box (if exists) which the vertex belongs to. Boxes with same names are not distinguished and so they should have the same attributes.

val default_edge_attributes : t -> Graphviz.DotAttributes.edge list
val edge_attributes : E.t -> Graphviz.DotAttributes.edge list
end) -> sig .. end

The neato engine

module NeatoAttributes: sig .. end

The NeatoAttributes module defines attributes for graphs, nodes and edges that are available in the neato engine.

module Neato: 
functor (X : sig

Graph implementation. Sub-signature of Sig.G.

type t 
module V: sig .. end
module E: sig .. end
val iter_vertex : (V.t -> unit) -> t -> unit
val iter_edges_e : (E.t -> unit) -> t -> unit

Graph, vertex and edge attributes.

val graph_attributes : t -> Graphviz.NeatoAttributes.graph list
val default_vertex_attributes : t -> Graphviz.NeatoAttributes.vertex list
val vertex_name : V.t -> string
val vertex_attributes : V.t -> Graphviz.NeatoAttributes.vertex list
val get_subgraph : V.t -> Graphviz.NeatoAttributes.subgraph option

The box (if exists) which the vertex belongs to. Boxes with same names are not distinguished and so they should have the same attributes.

val default_edge_attributes : t -> Graphviz.NeatoAttributes.edge list
val edge_attributes : E.t -> Graphviz.NeatoAttributes.edge list
end) -> sig .. end