Module Graph

module Graph: sig .. end
Basic implementation of graphs, with output to various formats.


Graph representation

type vertex = {
   vertex_id :Utils.UTF8.t; (*Vertex identifier.*)
   vertex_cluster :Utils.UTF8.t option; (*Vertex cluster.*)
   vertex_label :Utils.UTF8.t option; (*Vertex label.*)
   vertex_properties :(Utils.UTF8.t * Utils.UTF8.t) list; (*Vertex properties.*)
}
The type of graph vertices.
type edge = {
   edge_id :Utils.UTF8.t; (*Edge identifier.*)
   edge_directed :bool; (*Whether edge is directed.*)
   edge_vertices :(Utils.UTF8.t * Utils.UTF8.t) list; (*Vertices (and associated labels) linked by edge (allowing hyperedge).*)
   edge_label :Utils.UTF8.t option; (*Edge label.*)
   edge_properties :(Utils.UTF8.t * Utils.UTF8.t) list; (*Edge properties.*)
}
The type of graph edges.
type t = {
   vertices :vertex list; (*Graph vertices.*)
   edges :edge list; (*Graph edges.*)
   vertice_types :(Utils.UTF8.t * Utils.UTF8.t) list; (*Association list from property names to their types.*)
   edge_types :(Utils.UTF8.t * Utils.UTF8.t) list; (*Association list from property names to their types.*)
}
The type of graphs.

Graph builders

type builder 
The type of graph builder.
val make : unit -> builder
Returns a builder containing an empty graph.
val to_graph : builder -> t
Returns the graph as constructed by the passed builder.
val add_vertex : ?cluster:Utils.UTF8.t ->
?label:Utils.UTF8.t ->
?properties:(Utils.UTF8.t * Utils.UTF8.t) list ->
id:Utils.UTF8.t -> builder -> unit
Adds a vertex to the passed builder.
val add_edge : ?directed:bool ->
?label:Utils.UTF8.t ->
?properties:(Utils.UTF8.t * Utils.UTF8.t) list ->
id:Utils.UTF8.t ->
vertices:(Utils.UTF8.t * Utils.UTF8.t) list -> builder -> unit
Adds an edge to the passed builder.
val add_vertice_type : Utils.UTF8.t -> Utils.UTF8.t -> builder -> unit
add_type n t b adds the information that properties with name n have type t to builder b.
val add_edge_type : Utils.UTF8.t -> Utils.UTF8.t -> builder -> unit
add_type n t b adds the information that properties with name n have type t to builder b.

Output

type format = 
| Dot (*Dot format (http://www.graphviz.org/doc/info/lang.html).*)
| GraphML (*GraphML format (http://graphml.graphdrawing.org).*)
| GEXF (*gexf format (http://gexf.net/format/).*)
The type of all output formats.
val all_formats : format list
The list of all output formats.
val string_of_format : format -> string
Converts the passed format into a string.
val dump : format -> t -> Utils.UTF8Buffer.t -> unit
dump fmt g buf dumps the data of graph g to buffer buf, using format fmt.