module type G = sig end
Graph structure
|
type t
module V: sig endV.t and are labeled with type V.label
(note that an implementation may identify the vertex with its
label)
module E: sig endE.t and are labeled with type E.label.
val is_directed : bool
Size functions
|
val is_empty : t -> boolval nb_vertex : t -> intval nb_edges : t -> intval out_degree : t -> V.t -> intout_degree g v returns the out-degree of v in g.
Raise Invalid_argument if v is not in g.val in_degree : t -> V.t -> intin_degree g v returns the in-degree of v in g.
Raise Invalid_argument if v is not in g.
Membership functions
|
val mem_vertex : t -> V.t -> boolval mem_edge : t -> V.t -> V.t -> boolval mem_edge_e : t -> E.t -> bool
Successors and predecessors
|
val succ : t -> V.t -> V.t listsucc g v returns the successors of v in g.
Raise Invalid_argument if v is not in g.val pred : t -> V.t -> V.t listpred g v returns the predecessors of v in g.
Raise Invalid_argument if v is not in g.val succ_e : t -> V.t -> E.t listsucc_e g v returns the edges going from v in g.
Raise Invalid_argument if v is not in g.val pred_e : t -> V.t -> E.t listpred_e g v returns the edges going to v in g.
Raise Invalid_argument if v is not in g.
Graph iterators
|
val iter_vertex : (V.t -> unit) -> t -> unitval iter_edges : (V.t -> V.t -> unit) -> t -> unitval fold_vertex : (V.t -> 'a -> 'a) -> t -> 'a -> 'aval fold_edges : (V.t -> V.t -> 'a -> 'a) -> t -> 'a -> 'aval map_vertex : (V.t -> V.t) -> t -> tval iter_edges_e : (E.t -> unit) -> t -> unitval fold_edges_e : (E.t -> 'a -> 'a) -> t -> 'a -> 'a
Vertex iterators
|
Each iterator iterator f v g iters f to the successors/predecessors
of v in the graph g and raises Invalid_argument if v is not in
g.
iter/fold on all successors/predecessors of a vertex.
val iter_succ : (V.t -> unit) -> t -> V.t -> unitval iter_pred : (V.t -> unit) -> t -> V.t -> unitval fold_succ : (V.t -> 'a -> 'a) -> t -> V.t -> 'a -> 'aval fold_pred : (V.t -> 'a -> 'a) -> t -> V.t -> 'a -> 'aval iter_succ_e : (E.t -> unit) -> t -> V.t -> unitval fold_succ_e : (E.t -> 'a -> 'a) -> t -> V.t -> 'a -> 'aval iter_pred_e : (E.t -> unit) -> t -> V.t -> unitval fold_pred_e : (E.t -> 'a -> 'a) -> t -> V.t -> 'a -> 'a