Up

module Gmap

: sig

Graph mapping. Map a graph to another one.

Mapping of vertices

#
module type V_SRC = sig

Signature for the source graph.

#
type t
#
module V : Sig.HASHABLE
#
val fold_vertex : (V.t -> 'a -> 'a) -> t -> 'a -> 'a
end
#
module type V_DST = sig

Signature for the destination graph.

#
type t
#
type vertex
#
val empty : unit -> t
#
val add_vertex : t -> vertex -> t
end
#
module Vertex : functor (G_Src : V_SRC) -> functor (G_Dst : V_DST) -> sig

Provide a mapping function from a mapping of vertices.

#
val map : (G_Src.V.t -> G_Dst.vertex) -> G_Src.t -> G_Dst.t

map f g applies f to each vertex of g and so builds a new graph based on g

#
val filter_map : (G_Src.V.t -> G_Dst.vertex option) -> G_Src.t -> G_Dst.t

filter_map f g applies f to each vertex of g and so builds a new graph based on g; if None is returned by f the vertex is omitted in the new graph.

end

Mapping of edges

#
module type E_SRC = sig

Signature for the source graph.

#
type t
#
module E : Sig.ORDERED_TYPE
#
val fold_edges_e : (E.t -> 'a -> 'a) -> t -> 'a -> 'a
end
#
module type E_DST = sig

Signature for the destination graph.

#
type t
#
type edge
#
val empty : unit -> t
#
val add_edge_e : t -> edge -> t
end
#
module Edge : functor (G_Src : E_SRC) -> functor (G_Dst : E_DST) -> sig

Provide a mapping function from a mapping of edges.

#
val map : (G_Src.E.t -> G_Dst.edge) -> G_Src.t -> G_Dst.t

map f g applies f to each edge of g and so builds a new graph based on g

#
val filter_map : (G_Src.E.t -> G_Dst.edge option) -> G_Src.t -> G_Dst.t

filter_map f g applies f to each edge of g and so builds a new graph based on g; if None is returned by f the edge is omitted in the new graph.

end
end