Module Bigraph.Link
Faces
module Face : sig ... end
This module provides set operations for faces.
Ports
module Ports : sig ... end
This module implements multisets of nodes as maps.
Link graphs
module Lg : sig ... end
This module provides set operations for link graphs.
val parse_face : string list -> Face.t
parse_face ns
computes a face starting from list of string namesns
.
val string_of_face : Face.t -> string
string_of_face f
computes the string representation of facef
.
val pp_face : Stdlib.Format.formatter -> Face.t -> unit
Pretty printer.
val to_string : Lg.t -> string
to_string l
computes the string representation of link graphl
.
val pp : Stdlib.Format.formatter -> Lg.t -> unit
Pretty printer.
val of_string : string -> Lg.t
Opposite of
Link.to_string
.- raises Invalid_argument
if the input cannot be parsed.
val get_dot : Lg.t -> string * string * string * string
get_dot l
computes a four-elements tuple encoding the dot representation of link graphl
. The first two elements represent inner and outer names shape declarations. The third element represent the hyperedges shape declarations. The fourth element specifies the adjacency matrix.
Elementary link graphs
val elementary_sub : inner:Face.t -> outer:Face.t -> Lg.t
elementary_sub inner outer
computes a substitution consisting of a single edge in whichinner
andouter
are the inner and outer face, respectively.
val elementary_id : Face.t -> Lg.t
elementary_id f
computes the identity over facef
, i.e. one edge for each name inf
.
val id_empty : Lg.t
id_empty
is the empty link graph.
Operations on link graphs
exception
NAMES_ALREADY_DEFINED of Face.t * Face.t
Raised when the tensor product between two incompatible link graphs cannot be performed. The first element is the set of inner common names while the second is the set of outer common names.
exception
FACES_MISMATCH of Face.t * Face.t
Raised when a composition between two incompatible link graphs cannot be performed.
val tens : Lg.t -> Lg.t -> int -> Lg.t
tens a b n
computes the tensor product of link graphsa
andb
. Argumentn
is the number of nodes ofa
.- raises NAMES_ALREADY_DEFINED
when there are shared names.
Predicates
val is_id : Lg.t -> bool
is_id l
istrue
if link graphl
is an identity,false
otherwise.
val is_mono : Lg.t -> bool
is_mono l
istrue
if link graphl
is monomorphic,false
otherwise. A link graph is monomorphic if every edge has at most one inner name.
val is_epi : Lg.t -> bool
is_epi l
istrue
if link graphl
is epimorphic,false
otherwise. A link graph is epimorphic if no outer name is idle.
val is_ground : Lg.t -> bool
is_ground l
istrue
if link graphl
has no inner names,false
otherwise.
val is_guard : Lg.t -> bool
is_guard l
istrue
if no edges in link graphl
have both inner and outer names,false
otherwise.
val max_ports : Lg.t -> int
Compute the maximum number of ports in one edge of a link graph.
val cardinal_ports : Lg.t -> int list
Compute a sorted list with the cardinalities of the port sets.
val closed_edges : Lg.t -> int
Compute the number of closed edges.
Decompositions
val norm : Lg.t -> Lg.t * Lg.t
Normalise link graph
l
as follows:l = omega o l'
whereomega
is a linking andl'
is the same asl
but with all links open.
val decomp : target:Lg.t -> pattern:Lg.t -> i_e:Iso.t -> i_c:Iso.t -> i_d:Iso.t -> Fun.t -> Lg.t * Lg.t * Lg.t
decomp target pattern i_e i_c i_d f_e
computes the decomposition oftarget
givenpattern
, isoi_e
, and isos from nodes int
to nodes ofc
andd
, respectively. Argumentf_e
is a total function from links in the pattern to links in the target. Patternp
is assumed epi and mono andi_e
is from edges inp
to edges int
. Isosi_c
andi_d
are obtained byPlace.decomp
. The results are link graphc
,d
andid
.
val prime_components : Lg.t -> Iso.t list -> Lg.t list
Compute the prime components of a link graph. See
Place.decomp
.