package prbnmcn-stats

  1. Overview
  2. Docs

Tree defines a type of trees and functions to construct, deconstruct and iterate on those trees.

type t
val cons : vertex -> t list -> t

cons v sub constructs a tree with root v and subtrees sub.

val uncons : t -> vertex * t list

uncons t deconstructs t into a pair of its root and its subtrees.

val mem_vertex : t -> vertex -> bool

mem_vertex t v

val iter_vertices : t -> (vertex -> unit) -> unit

iter_vertices t f iterates f on the nodes of t.

val iter_edges : t -> ((vertex * vertex) -> unit) -> unit

iter_edges t f iterates f on the edges of t. The edges are directed from each node towards its subtrees.