package unionFind

  1. Overview
  2. Docs
Implementations of the union-find data structure

Install

Dune Dependency

Authors

Maintainers

Sources

archive.tar.gz
md5=7238ac49fba7c730e90cf1a577207347
sha512=c49dd3f9a6689f6a5efe39c26efe2c137f8812b4be6ee76c2cc20068cf86ad73c0ac97ec9a543245dddb63792ce8c1904576b3435bf419cc7837bc5e368eee6d

doc/unionFind/UnionFind/StoreMap/index.html

Module UnionFind.StoreMapSource

This module offers stores based on immutable integer maps. These stores support a constant-time copy operation. The module UnionFind.StoreMap itself is an implementation of stores based on OCaml's Map module. The functor UnionFind.StoreMap.Make can also be used to construct an implementation of stores based on a user-provided implementation of immutable maps.

Sourcetype 'a store

A store can be thought of as a region of memory in which objects, known as references, can be dynamically allocated, read, and written. Stores are homogeneous: all references in a store of type 'a store have the content type, namely 'a. In general, a store should be thought of as a mutable object. Some stores support a cheap copy operation, because the underlying data structure allows it: for instance, a store implemented as a reference to a persistent map supports cheap copies. Some stores do not support copy at all: for instance, a store implemented using primitive references does not support copies.

Sourceval new_store : unit -> 'a store

new_store() creates an empty store.

Sourceval copy : 'a store -> 'a store

copy s returns a copy of the store s. Every reference that is valid in the store s is also valid in the new store, and has the same content in both stores. The two stores are independent of one another: updating one of them does not affect the other. When supported, copy is cheap: it can be expected to run in constant time. However, some stores does not support copy; in that case, an unspecified exception is raised.

Sourcetype 'a rref

A reference of type 'a rref can be thought of as (a pointer to) an object that exists in some store.

Sourceval make : 'a store -> 'a -> 'a rref

make s v creates a fresh reference in the store s and sets its content to v. It updates the store in place and returns the newly-created reference.

Sourceval get : 'a store -> 'a rref -> 'a

get s x reads the current content of the reference x in the store s. It may update the store in place, and returns the current content of the reference.

Sourceval set : 'a store -> 'a rref -> 'a -> unit

set s x v updates the store s so as to set the content of the reference x to v. It updates the store in place.

Sourceval eq : 'a store -> 'a rref -> 'a rref -> bool

eq s x y determines whether the references x and y are the same reference. It may update the store in place, and returns a Boolean result. The references x and y must belong to the store s.

Sourcemodule Make (IntMap : sig ... end) : sig ... end

Make constructs persistent stores based on immutable integer maps.

OCaml

Innovation. Community. Security.