sig
type 'a sequence = ('a -> unit) -> unit
type 'a sequence_once = 'a CCGraph.sequence
exception Sequence_once
module Seq :
sig
type 'a t = 'a CCGraph.sequence
val return : 'a -> 'a CCGraph.sequence
val ( >>= ) :
'a CCGraph.Seq.t -> ('a -> 'b CCGraph.Seq.t) -> 'b CCGraph.Seq.t
val map : ('a -> 'b) -> 'a CCGraph.Seq.t -> 'b CCGraph.Seq.t
val filter_map :
('a -> 'b option) -> 'a CCGraph.Seq.t -> 'b CCGraph.Seq.t
val iter : ('a -> unit) -> 'a CCGraph.Seq.t -> unit
val fold : ('b -> 'a -> 'b) -> 'b -> 'a CCGraph.Seq.t -> 'b
val to_list : 'a CCGraph.Seq.t -> 'a list
end
type ('v, 'e) t = {
children : 'v -> 'e CCGraph.sequence;
origin : 'e -> 'v;
dest : 'e -> 'v;
}
type ('v, 'e) graph = ('v, 'e) CCGraph.t
val make :
origin:('e -> 'v) ->
dest:('e -> 'v) -> ('v -> 'e CCGraph.sequence) -> ('v, 'e) CCGraph.t
val make_labelled_tuple :
('v -> ('a * 'v) CCGraph.sequence) -> ('v, 'v * 'a * 'v) CCGraph.t
val make_tuple : ('v -> 'v CCGraph.sequence) -> ('v, 'v * 'v) CCGraph.t
type 'v tag_set = { get_tag : 'v -> bool; set_tag : 'v -> unit; }
type ('k, 'a) table = {
mem : 'k -> bool;
find : 'k -> 'a;
add : 'k -> 'a -> unit;
}
type 'a set = ('a, unit) CCGraph.table
val mk_table :
?eq:('k -> 'k -> bool) ->
?hash:('k -> int) -> int -> ('k, 'a) CCGraph.table
val mk_map : ?cmp:('k -> 'k -> int) -> unit -> ('k, 'a) CCGraph.table
type 'a bag = {
push : 'a -> unit;
is_empty : unit -> bool;
pop : unit -> 'a;
}
val mk_queue : unit -> 'a CCGraph.bag
val mk_stack : unit -> 'a CCGraph.bag
val mk_heap : leq:('a -> 'a -> bool) -> 'a CCGraph.bag
module Traverse :
sig
type 'e path = 'e list
val generic :
?tbl:'v CCGraph.set ->
bag:'v CCGraph.bag ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence -> 'v CCGraph.sequence_once
val generic_tag :
tags:'v CCGraph.tag_set ->
bag:'v CCGraph.bag ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence -> 'v CCGraph.sequence_once
val dfs :
?tbl:'v CCGraph.set ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence -> 'v CCGraph.sequence_once
val dfs_tag :
tags:'v CCGraph.tag_set ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence -> 'v CCGraph.sequence_once
val bfs :
?tbl:'v CCGraph.set ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence -> 'v CCGraph.sequence_once
val bfs_tag :
tags:'v CCGraph.tag_set ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence -> 'v CCGraph.sequence_once
val dijkstra :
?tbl:'v CCGraph.set ->
?dist:('e -> int) ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence ->
('v * int * 'e CCGraph.Traverse.path) CCGraph.sequence_once
val dijkstra_tag :
?dist:('e -> int) ->
tags:'v CCGraph.tag_set ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence ->
('v * int * 'e CCGraph.Traverse.path) CCGraph.sequence_once
module Event :
sig
type edge_kind = [ `Back | `Cross | `Forward ]
type ('v, 'e) t =
[ `Edge of 'e * CCGraph.Traverse.Event.edge_kind
| `Enter of 'v * int * 'e CCGraph.Traverse.path
| `Exit of 'v ]
val get_vertex :
('v, 'e) CCGraph.Traverse.Event.t ->
('v * [ `Enter | `Exit ]) option
val get_enter : ('v, 'e) CCGraph.Traverse.Event.t -> 'v option
val get_exit : ('v, 'e) CCGraph.Traverse.Event.t -> 'v option
val get_edge : ('v, 'e) CCGraph.Traverse.Event.t -> 'e option
val get_edge_kind :
('v, 'e) CCGraph.Traverse.Event.t ->
('e * CCGraph.Traverse.Event.edge_kind) option
val dfs :
?tbl:'v CCGraph.set ->
?eq:('v -> 'v -> bool) ->
graph:('v, 'e) CCGraph.graph ->
'v CCGraph.sequence ->
('v, 'e) CCGraph.Traverse.Event.t CCGraph.sequence_once
val dfs_tag :
?eq:('v -> 'v -> bool) ->
tags:'v CCGraph.tag_set ->
graph:('v, 'e) CCGraph.graph ->
'v CCGraph.sequence ->
('v, 'e) CCGraph.Traverse.Event.t CCGraph.sequence_once
end
end
val is_dag :
?tbl:'v CCGraph.set ->
graph:('v, 'a) CCGraph.t -> 'v CCGraph.sequence -> bool
exception Has_cycle
val topo_sort :
?eq:('v -> 'v -> bool) ->
?rev:bool ->
?tbl:'v CCGraph.set ->
graph:('v, 'e) CCGraph.t -> 'v CCGraph.sequence -> 'v list
val topo_sort_tag :
?eq:('v -> 'v -> bool) ->
?rev:bool ->
tags:'v CCGraph.tag_set ->
graph:('v, 'e) CCGraph.t -> 'v CCGraph.sequence -> 'v list
module LazyTree :
sig
type ('v, 'e) t =
Vertex of 'v * ('e * ('v, 'e) CCGraph.LazyTree.t) list Lazy.t
val map_v :
('a -> 'b) ->
('a, 'e) CCGraph.LazyTree.t -> ('b, 'e) CCGraph.LazyTree.t
val fold_v :
('acc -> 'v -> 'acc) -> 'acc -> ('v, 'a) CCGraph.LazyTree.t -> 'acc
end
val spanning_tree :
?tbl:'v CCGraph.set ->
graph:('v, 'e) CCGraph.t -> 'v -> ('v, 'e) CCGraph.LazyTree.t
val spanning_tree_tag :
tags:'v CCGraph.tag_set ->
graph:('v, 'e) CCGraph.t -> 'v -> ('v, 'e) CCGraph.LazyTree.t
type 'v scc_state
val scc :
?tbl:('v, 'v CCGraph.scc_state) CCGraph.table ->
graph:('v, 'e) CCGraph.t ->
'v CCGraph.sequence -> 'v list CCGraph.sequence_once
module Dot :
sig
type attribute =
[ `Color of string
| `Label of string
| `Other of string * string
| `Shape of string
| `Style of string
| `Weight of int ]
type vertex_state
val pp :
?tbl:('v, CCGraph.Dot.vertex_state) CCGraph.table ->
?eq:('v -> 'v -> bool) ->
?attrs_v:('v -> CCGraph.Dot.attribute list) ->
?attrs_e:('e -> CCGraph.Dot.attribute list) ->
?name:string ->
graph:('v, 'e) CCGraph.t -> Format.formatter -> 'v -> unit
val pp_seq :
?tbl:('v, CCGraph.Dot.vertex_state) CCGraph.table ->
?eq:('v -> 'v -> bool) ->
?attrs_v:('v -> CCGraph.Dot.attribute list) ->
?attrs_e:('e -> CCGraph.Dot.attribute list) ->
?name:string ->
graph:('v, 'e) CCGraph.t ->
Format.formatter -> 'v CCGraph.sequence -> unit
val with_out : string -> (Format.formatter -> 'a) -> 'a
end
type ('v, 'e) mut_graph =
< add_edge : 'e -> unit; graph : ('v, 'e) CCGraph.t;
remove : 'v -> unit >
val mk_mut_tbl :
?eq:('v -> 'v -> bool) ->
?hash:('v -> int) -> int -> ('v, 'v * 'a * 'v) CCGraph.mut_graph
module type MAP =
sig
type vertex
type t
val as_graph :
CCGraph.MAP.t ->
(CCGraph.MAP.vertex, CCGraph.MAP.vertex * CCGraph.MAP.vertex)
CCGraph.graph
val empty : CCGraph.MAP.t
val add_edge :
CCGraph.MAP.vertex ->
CCGraph.MAP.vertex -> CCGraph.MAP.t -> CCGraph.MAP.t
val remove_edge :
CCGraph.MAP.vertex ->
CCGraph.MAP.vertex -> CCGraph.MAP.t -> CCGraph.MAP.t
val add : CCGraph.MAP.vertex -> CCGraph.MAP.t -> CCGraph.MAP.t
val remove : CCGraph.MAP.vertex -> CCGraph.MAP.t -> CCGraph.MAP.t
val union : CCGraph.MAP.t -> CCGraph.MAP.t -> CCGraph.MAP.t
val vertices : CCGraph.MAP.t -> CCGraph.MAP.vertex CCGraph.sequence
val vertices_l : CCGraph.MAP.t -> CCGraph.MAP.vertex list
val of_list :
(CCGraph.MAP.vertex * CCGraph.MAP.vertex) list -> CCGraph.MAP.t
val add_list :
(CCGraph.MAP.vertex * CCGraph.MAP.vertex) list ->
CCGraph.MAP.t -> CCGraph.MAP.t
val to_list :
CCGraph.MAP.t -> (CCGraph.MAP.vertex * CCGraph.MAP.vertex) list
val of_seq :
(CCGraph.MAP.vertex * CCGraph.MAP.vertex) CCGraph.sequence ->
CCGraph.MAP.t
val add_seq :
(CCGraph.MAP.vertex * CCGraph.MAP.vertex) CCGraph.sequence ->
CCGraph.MAP.t -> CCGraph.MAP.t
val to_seq :
CCGraph.MAP.t ->
(CCGraph.MAP.vertex * CCGraph.MAP.vertex) CCGraph.sequence
end
module Map :
functor (O : Map.OrderedType) ->
sig
type vertex = O.t
type t
val as_graph : t -> (vertex, vertex * vertex) graph
val empty : t
val add_edge : vertex -> vertex -> t -> t
val remove_edge : vertex -> vertex -> t -> t
val add : vertex -> t -> t
val remove : vertex -> t -> t
val union : t -> t -> t
val vertices : t -> vertex sequence
val vertices_l : t -> vertex list
val of_list : (vertex * vertex) list -> t
val add_list : (vertex * vertex) list -> t -> t
val to_list : t -> (vertex * vertex) list
val of_seq : (vertex * vertex) sequence -> t
val add_seq : (vertex * vertex) sequence -> t -> t
val to_seq : t -> (vertex * vertex) sequence
end
val of_list :
?eq:('v -> 'v -> bool) -> ('v * 'v) list -> ('v, 'v * 'v) CCGraph.t
val of_hashtbl : ('v, 'v list) Hashtbl.t -> ('v, 'v * 'v) CCGraph.t
val of_fun : ('v -> 'v list) -> ('v, 'v * 'v) CCGraph.t
val divisors_graph : (int, int * int) CCGraph.t
end