package biocaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=497e3f2f7128a6ca347d66848da38a3d
sha512=4a76ebbafda3bc944afaff40d69791dfe153a0638ef5d7e6e1bc962b7f991d9545cd0af2d7930b39f8b31dbf067d0603cfa03d9b7a49396ab1ae452df47fd1f3
doc/biocaml.unix/Biocaml_unix/Interval_tree/index.html
Module Biocaml_unix.Interval_tree
Interval tree (data structure)
An interval tree is a collection of integer-bounded intervals labeled by a value.
For a brief description of the implementation, see the matching Wikipedia article
Accessors
val is_empty : 'a t -> boolval cardinal : 'a t -> intval intersects : 'a t -> low:int -> high:int -> boolintersects a b t returns true if one interval in t intersects with the interval [a;b].
Constructors
val empty : 'a tthe empty tree
add lo hi v t adds the interval (lo, hi) labeled with value v to the contents of t. Note that in contrast to sets, identical intervals (even with identical labels) may be *repeated* in an interval tree. E.g., add 1 2 () (add 1 2 ()) contains 2 intervals.
Conversion
val elements : 'a t -> (int * int * 'a) listval to_stream : 'a t -> (int * int * 'a) Stream.tval to_backwards_stream : 'a t -> (int * int * 'a) Stream.tSearching and filtering
val find_closest : int -> int -> 'a t -> int * int * 'a * intfind_closest lo hi t returns the interval in t which is at minimal distance of the interval [lo;hi]. The resulting tuple contains from left to right, left-end of the interval, right-end of the interval, value associated to the interval and distance to the interval given in argument. Overlapping intervals are at distance 0 of each other.
Raises Empty_tree if t is empty
val find_intersecting_elem : int -> int -> 'a t -> (int * int * 'a) Stream.tfind_intersecting_elem a b t is equivalent to Stream.filter ~f:(fun (x,y,_) -> intersects x y t) (stream t) but is more efficient.
Create an interval tree with the elements which overlap with [low, high].
Misc
val print : 'a t -> unitUsed for debugging purpose, should be removed in the long run
val check_integrity : 'a t -> unitUsed for debugging purpose, should be removed in the long run