Module Bigraph.Nodes

Operations on sets of bigraph nodes.

type t

The type of a set of nodes.

val pp : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit
val show : t -> Ppx_deriving_runtime.string
val to_yojson : t -> Yojson.Safe.t
val of_yojson : Yojson.Safe.t -> t Ppx_deriving_yojson_runtime.error_or
val singleton : Ctrl.t -> t

singleton c builds a set with a single element of control c.

val apply : Iso.t -> t -> t

Apply an isomorphism. Nodes without an image are dropped.

val empty : t

The empty node set.

val equal : t -> t -> bool

Equality test. Node identifiers are ignored.

val find_all : Ctrl.t -> t -> IntSet.t

find_all c ns finds all the nodes in node set ns with control c.

val fold : (int -> Ctrl.t -> 'a -> 'a) -> t -> 'a -> 'a

Fold over a set.

val get_ctrl : int -> t -> Ctrl.t option

get_ctrl i ns returns the control of node i in node set ns.

val is_empty : t -> bool

Return true if the set is empty.

val iter : (int -> Ctrl.t -> unit) -> t -> unit

Iterate over a set.

val eval : t -> Expr.env -> t

Evaluate control expressions.

val ground : t -> Expr.env -> string list -> t

Ground control parameter expressions that reference a name in the given list, within the given environment (see Ctrl.ground_exprs).

val for_all : (int -> Ctrl.t -> bool) -> t -> bool

Check a boolean predicate holds for all the elements of a set.

val exists : (int -> Ctrl.t -> bool) -> t -> bool

Check a boolean predicate holds for at least one element of a set.

val norm : t -> string

Compute the norm of a set. The norm is defined as a string representing a sorted list of controls. Example:

  "A~A(4)~C~D(3,6.2)~T"
val norm_set : t -> IntSet.t -> string

norm_set ns s is like norm but only nodes in s are included.

val flatten : t -> t

flatten ns replaces each control with its unparameterized base name equivalent, preserving node IDs. Used for wildcard matching.

val ctrl_counts : t -> (string * int) list

ctrl_counts ns returns a sorted list of (control_name, count) pairs, one per distinct unparameterized control name in ns. Useful for cached per-control count checking in pattern matching.

val size : t -> int

Return the cardinality of a node set.

val tens : t -> t -> t

tens n0 n1 returns the disjoint union of node sets n0 and n1. Note: no check is performed on control arities.

val to_dot : t -> string

to_dot ns returns a string expressing node shapes in dot format.