package libsail

  1. Overview
  2. Docs

Parameters

module Ord : OrderedType

Signature

type node = Ord.t
type graph = Stdlib.Set.Make(Ord).t Stdlib.Map.Make(Ord).t
type node_set = Stdlib.Set.Make(Ord).t
val leaves : graph -> node_set
val empty : graph
val add_edge : node -> node -> graph -> graph

Add an edge from the first node to the second node, creating the nodes if they do not exist.

val add_edges : node -> node list -> graph -> graph
val children : graph -> node -> node list
val nodes : graph -> node list
val reachable : node_set -> node_set -> graph -> node_set

Return the set of nodes that are reachable from the first set of nodes (roots), without passing through the second set of nodes (cuts).

val prune : node_set -> node_set -> graph -> graph

Prune a graph from roots to cuts.

val remove_self_loops : graph -> graph
val reverse : graph -> graph
exception Not_a_DAG of node * graph
val topsort : graph -> node list

Topologically sort a graph. Throws Not_a_DAG if the graph is not directed acyclic.

val scc : ?original_order:node list -> graph -> node list list

Find strongly connected components using Tarjan's algorithm. This algorithm also returns a topological sorting of the graph components.

val make_dot : (node -> string) -> (node -> node -> string) -> (node -> string) -> Stdlib.out_channel -> graph -> unit
OCaml

Innovation. Community. Security.