package libsail

  1. Overview
  2. Docs
include Graph.S with type node = Ast.id
type node = Ast.id
type graph
type node_set
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 self_loops : graph -> node list
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_color:(node -> string) -> edge_color:(node -> node -> string) -> string_of_node:(node -> string) -> Stdlib.out_channel -> graph -> unit
OCaml

Innovation. Community. Security.