package logtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module UnionFind.MakeSource

Build a union-find module from a key/value specification

Parameters

module P : PAIR

Signature

Sourcetype key = P.key

Elements that can be compared

Sourcetype value = P.value

Values associated with elements

Sourcetype t

The union-find imperative structure itself

Sourceval create : key list -> t

Create a union-find for the given elements. Elements are mapped to zero by default.

Sourceval mem : t -> key -> bool

Does the key belong to the UF?

Sourceval find : t -> key -> key

Finds the representative of this key's equivalence class.

  • raises Not_found

    if the key does not belong to the UF

Sourceval find_value : t -> key -> value

Find value for the given element. The value is the monoid merge of all values associated to key's equivalence class.

Sourceval union : t -> key -> key -> unit

Merge two elements (and their equivalence classes)

Sourceval add : t -> key -> value -> unit

Add the given value to the key's class (monoid). It modifies the value by merging it with value. If the key does not belong to the union-find, it is added.

Sourceval iter : t -> (key -> value -> unit) -> unit

Iterate on representative and their value

Sourceval to_seq : t -> (key * value) Iter.t
OCaml

Innovation. Community. Security.