Something went wrong. Try again.
An implementation of the PubGrub version solving algorithm in OCaml.
Something went wrong. Try again.
643 B · 20 lines
OCaml
at perf
123456789101112131415161718192021(** Min priority queue keyed on a name with an integer priority. Ties broken by the name's own [compare]. All operations are O(log n). *)
module Make (N : Types.NAME) : sig type t
val empty : t
val insert : t -> N.t -> int -> t (** [insert pq n p]: associate name [n] with priority [p]. *)
val remove : t -> N.t -> t (** [remove pq n]: drop [n] from the queue if present. *)
val update : t -> N.t -> int -> t (** [update pq n p]: set [n]'s priority to [p], replacing any existing entry. *)
val min_elt : t -> (int * N.t) option (** [min_elt pq]: the smallest [(priority, name)] pair, or [None] when empty. *)end