module Graph:Undirected graphsSig_pack.S
type t
module V:sig..end
typevertex =V.t
module E:sig..end
typeedge =E.t
val is_directed : boolval create : ?size:int -> unit -> tsize is
just an initial guess.val copy : t -> tcopy g returns a copy of g. Vertices and edges (and eventually
marks, see module Mark) are duplicated.val add_vertex : t -> V.t -> unitadd_vertex g v adds the vertex v from the graph g.
Do nothing if v is already in g.val remove_vertex : t -> V.t -> unitremove g v removes the vertex v from the graph g
(and all the edges going from v in g).
Do nothing if v is not in g.val add_edge : t -> V.t -> V.t -> unitadd_edge g v1 v2 adds an edge from the vertex v1 to the vertex v2
in the graph g.
Add also v1 (resp. v2) in g if v1 (resp. v2) is not in g.
Do nothing if this edge is already in g.val add_edge_e : t -> E.t -> unitadd_edge_e g e adds the edge e in the graph g.
Add also E.src e (resp. E.dst e) in g if E.src e (resp. E.dst
e) is not in g.
Do nothing if e is already in g.val remove_edge : t -> V.t -> V.t -> unitremove_edge g v1 v2 removes the edge going from v1 to v2 from the
graph g.
Do nothing if this edge is not in g.Invalid_argument if v1 or v2 are not in g.val remove_edge_e : t -> E.t -> unitremove_edge_e g e removes the edge e from the graph g.
Do nothing if e is not in g.Invalid_argument if E.src e or E.dst e are not in g.module Mark:sig..end
Marking below)
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.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.Invalid_argument if v is not in g.val mem_vertex : t -> V.t -> boolval mem_edge : t -> V.t -> V.t -> boolval mem_edge_e : t -> E.t -> boolval find_edge : t -> V.t -> V.t -> E.tval succ : t -> V.t -> V.t listsucc g v returns the successors of v in g.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.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.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.Invalid_argument if v is not in g.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
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 -> 'aval find_vertex : t -> int -> V.tvertex g i returns a vertex of label i in g. The behaviour is
unspecified if g has several vertices with label i.
Note: this function is inefficient (linear in the number of vertices);
you should better keep the vertices as long as you create them.val transitive_closure : ?reflexive:bool -> t -> ttransitive_closure ?reflexive g returns the transitive closure
of g (as a new graph). Loops (i.e. edges from a vertex to itself)
are added only if reflexive is true (default is false).val add_transitive_closure : ?reflexive:bool -> t -> tadd_transitive_closure ?reflexive g replaces g by its
transitive closure. Meaningless for persistent implementations
(then acts as transitive_closure).val mirror : t -> tmirror g returns a new graph which is the mirror image of g:
each edge from u to v has been replaced by an edge from v to u.
For undirected graphs, it simply returns a copy of g.val complement : t -> tcomplement g builds a new graph which is the complement of g:
each edge present in g is not present in the resulting graph and
vice-versa. Edges of the returned graph are unlabeled.val intersect : t -> t -> tintersect g1 g2 returns a new graph which is the intersection of g1
and g2: each vertex and edge present in g1 *and* g2 is present
in the resulting graph.val union : t -> t -> tunion g1 g2 returns a new graph which is the union of g1 and g2:
each vertex and edge present in g1 *or* g2 is present in the
resulting graph.module Dfs:sig..end
module Bfs:sig..end
module Marking:sig..end
module Classic:sig..end
module Rand:sig..end
module Components:sig..end
val shortest_path : t -> V.t -> V.t -> E.t list * intval ford_fulkerson : t ->
V.t -> V.t -> (E.t -> int) * intval goldberg : t ->
V.t -> V.t -> (E.t -> int) * intmodule PathCheck:sig..end
module Topological:sig..end
val spanningtree : t -> E.t listval dot_output : t -> string -> unitval display_with_gv : t -> unitval parse_gml_file : string -> tval parse_dot_file : string -> tval print_gml_file : t -> string -> unit