Module Sig_pack.S.Dfs

module Dfs: sig .. end

Depth-first search


val iter : ?pre:(Sig_pack.S.V.t -> unit) ->
?post:(Sig_pack.S.V.t -> unit) -> Sig_pack.S.t -> unit

iter pre post g visits all nodes of g in depth-first search, applying pre to each visited node before its successors, and post after them. Each node is visited exactly once.

val prefix : (Sig_pack.S.V.t -> unit) -> Sig_pack.S.t -> unit

applies only a prefix function

val postfix : (Sig_pack.S.V.t -> unit) -> Sig_pack.S.t -> unit

applies only a postfix function

val fold : (Sig_pack.S.V.t -> 'a -> 'a) -> 'a -> Sig_pack.S.t -> 'a

Same thing, but for a single connected component

val iter_component : ?pre:(Sig_pack.S.V.t -> unit) ->
?post:(Sig_pack.S.V.t -> unit) -> Sig_pack.S.t -> Sig_pack.S.V.t -> unit
val prefix_component : (Sig_pack.S.V.t -> unit) -> Sig_pack.S.t -> Sig_pack.S.V.t -> unit
val postfix_component : (Sig_pack.S.V.t -> unit) -> Sig_pack.S.t -> Sig_pack.S.V.t -> unit
val fold_component : (Sig_pack.S.V.t -> 'a -> 'a) -> 'a -> Sig_pack.S.t -> Sig_pack.S.V.t -> 'a
val has_cycle : Sig_pack.S.t -> bool