package flatunionfind

  1. Overview
  2. Docs

Module FlatUnionFindSource

This module offers a union-find data structure based on disjoint set forests, with path compression and linking by rank. The data structure is stored in a flat integer vector.

Sourcemodule type UF = sig ... end

This signature describes the result of the functor FlatUnionFind.Make.

Sourcemodule type UFD = sig ... end

This signature describes the result of the functor FlatUnionFind.Wrap.

Sourcemodule Make () : UF

Applying the functor Make creates a fresh instance of the union-find data structure. This functor is generative: each application returns a new module, with its own mutable internal state and its own abstract type point.

Sourcemodule MakeWithData (D : sig ... end) () : UFD with type data = D.t

Applying the functor MakeWithData creates a fresh instance of the union-find data structure. In comparison with Make, this data structure offers one additional feature: it maintains a map of equivalence classes to user data. This functor is generative: each application returns a new module, with its own mutable internal state and its own abstract type point.