Module type MultiGraph.G
module type G =Signature specifying the common interface to all multi-graph implementations.sig
..end
Multi-Graph Structure
include Print.PRINTABLE_TYPE
The printable type of multi-graphs.
module Vertex:sig
..end
Module to manage vertices.
module Edge:sig
..end
Module to manage edges.
Size Functions
val nb_vertices : t -> int
nb_vertices g
returns the number of vertices in the multi-graph g
.val nb_edges : t -> int
nb_edges g
returns the number of edges in the multi-graph g
.Membership Functions
val mem_vertex : t -> Vertex.t -> bool
mem_vertex g v
tests whether the multi-graph g
contains the vertex v
.val mem_edge : t -> Edge.t -> bool
mem_edge g e
tests whether the multi-graph g
contains the edge e
.Iterators
The following iterators apply a given function
f
to some vertices (resp.
to some edges) of a given multi-graph. Each vertex (resp. each edge) is
passed at most once to the function f
. The order in which the vertices
(resp. the edges) are passed to f
is unspecified.Global Iterators
val iter_vertices : (Vertex.t -> unit) -> t -> unit
iter_vertices f g
applies f
in turn to all vertices of g
.val fold_vertices : (Vertex.t -> 'a -> 'a) -> t -> 'a -> 'a
fold_vertices f g a
returns (f vN ... (f v2 (f v1 a))...)
, where v1,
..., vN
are the vertices of g
.val iter_edges : (Edge.t -> unit) -> t -> unit
iter_edges f g
applies f
in turn to all edges of g
.val fold_edges : (Edge.t -> 'a -> 'a) -> t -> 'a -> 'a
fold_edges f g a
returns (f eN ... (f e2 (f e1 a))...)
, where e1, ...,
eN
are the edges of g
.Local Iterators
val iter_succ : (Edge.t -> unit) -> t -> Vertex.t -> unit
iter_succ f g v
applies f
in turn to all outbound edges of v
in
g
(i.e. all edges in g
with source E.src e
equal to v
).
Precondition
v
is a vertex contained in g
.val fold_succ : (Edge.t -> 'a -> 'a) -> t -> Vertex.t -> 'a -> 'a
fold_succ f g v a
returns (f eN ... (f e2 (f e1 a))...)
, where e1,
..., eN
are the outbound edges of v
in g
(i.e. the edges in g
with source E.src e
equal to v
).
Precondition
v
is a vertex contained in g
.val iter_pred : (Edge.t -> unit) -> t -> Vertex.t -> unit
iter_pred f g v
applies f
in turn to all inbound edges of v
in
g
(i.e. all edges in g
with target E.tgt e
equal to v
).
Precondition
v
is a vertex contained in g
.val fold_pred : (Edge.t -> 'a -> 'a) -> t -> Vertex.t -> 'a -> 'a
fold_pred f g v a
returns (f eN ... (f e2 (f e1 a))...)
, where e1,
..., eN
are the inbound edges of v
in g
(i.e. the edges in g
with target E.tgt e
equal to v
).
Precondition
v
is a vertex contained in g
.