module Graph: sig
.. end
Basic implementation of graphs, with output to various formats.
Graph representation
type
vertex = {
|
vertex_id :Utils.UTF8.t ; |
|
vertex_cluster :Utils.UTF8.t option ; |
|
vertex_label :Utils.UTF8.t option ; |
|
vertex_properties :(Utils.UTF8.t * Utils.UTF8.t) list ; |
}
The type of graph vertices.
type
edge = {
|
edge_id :Utils.UTF8.t ; |
|
edge_directed :bool ; |
|
edge_vertices :(Utils.UTF8.t * Utils.UTF8.t) list ; |
|
edge_label :Utils.UTF8.t option ; |
|
edge_properties :(Utils.UTF8.t * Utils.UTF8.t) list ; |
}
The type of graph edges.
type
t = {
|
vertices :vertex list ; |
|
edges :edge list ; |
|
vertice_types :(Utils.UTF8.t * Utils.UTF8.t) list ; |
|
edge_types :(Utils.UTF8.t * Utils.UTF8.t) list ; |
}
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 =
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
.