Parameter Make.5-View
val empty : t
empty
is the empty view.
val length : t -> int
lengh t
returns the number of nodes in viewt
val is_empty : t -> bool
is_empty t
returns true if there are no nodes in viewt
val oldest : t -> node option
oldest t
returns the oldest node in view. In case there are multiple oldest nodes, picks a random one of those.
val uniform_sample : int -> t -> t
uniform_sample n t
returns a uniform random sample of viewt
of lengthn
.
val weighted_sample : int -> t -> t
weighted_sample n t
returns a weighted random sample of viewt
of lengthn
, weighted by their trust values.
val adjust_trust : float -> t -> t
adjust_trust r t
adjust the trust value of all nodes int
by multiplying each withr
.
val filter_trust : float -> t -> t
filter_trust min_trust t
remove nodes with trust value less thanmin_trust
val min_trust : t -> float
min_trust t
returns the minimum trust value int
val max_trust : t -> float
max_trust t
returns the maximum trust value int
val sum_trust : t -> float
sum_trust t
returns the sum of trust values int
val filter : (nid -> node -> bool) -> t -> t
val fold : (nid -> node -> 'a -> 'a) -> t -> 'a -> 'a
val iter : (nid -> node -> unit) -> t -> unit
val map : (nid -> node -> node) -> t -> t
val to_list : t -> node list
val of_list : node list -> t
val pp : Stdlib.Format.formatter -> t -> unit
pp ppf t
pretty-prints viewt