package rtree

  1. Overview
  2. Docs

Module type Rtree.SSource

type t

An Rtree.

module Envelope : sig ... end

Envelopes for the Rtree.

module Value : sig ... end

Values stored in the Rtree.

type tree =
  1. | Node of (Envelope.t * tree) list
  2. | Leaf of (Envelope.t * Value.t) list
  3. | Empty
    (*

    The representation of a tree

    *)
val tree : t -> tree

Get a representation of the tree. There is no guarantee that this is the same representation used internally.

val empty : int -> t

The empty tree configured with a maximum load size. This is the number of children allowed at a level.

val insert : t -> Value.t -> t

Insert a new element into the tree

val remove : t -> Value.t -> Value.t list * t

remove tree element removes all elements with equality to the element passed, returning them and the new tree, or None if none are found

val remove_eq : t -> (Value.t -> bool) -> Value.t list * t

remove_eq tree pred removes all elements where pred returns true, returning them and the new tree. If the values returned is empty then no elements were found and the tree is unchanged.

val remove_env : t -> Envelope.t -> Value.t list * t

remove_env tree envelope removes all elements within a certain envelope, returning them and the new tree or None if none are found

val find : t -> Envelope.t -> Value.t list

find tree env find all value contained by env in tree.

val size : t -> int

size tree returns the number of element in the tree.

val bounds : t -> Envelope.t option

bounds tree returns the overall bounds of the tree. None is returned for the empty tree.

val values : t -> Value.t list

Returns all the values currently in the index.

val load : ?max_node_load:int -> Value.t list -> t

load vs will "bulk" load values into an r-tree. This will produce a better tree and is preferred over folding with insert.

It uses the OMT algorithm.

val depth : t -> int

depth tree returns the depth of the tree.

val iter : t -> (tree -> unit) -> unit

iter tree f will apply f to every internal tree node in t. For a Node this will first apply f then descend into the children.

val pp : Format.formatter -> t -> unit