package libsail

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include Graph.S with type node = Ast.id and type node_set = Ast_util.IdSet.t
type node = Ast.id
type graph
type node_set = Ast_util.IdSet.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 has_edge : node -> node -> graph -> bool
val delete_edge : node -> node -> graph -> graph
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 edge_list : graph -> (node * node) list
val transitive_reduction : graph -> graph

Note that this is at least O(n^3) where n is the number of nodes and very inefficiently constructs the result graph!

val make_multi_dot : node_color:(node -> string) -> edge_color:(node -> node -> string) -> string_of_node:(node -> string) -> Stdlib.out_channel -> (string * graph) list -> unit
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.