package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=9f673f79708b44a7effb3b6bb3618d2c
sha512=cb91cb428e43a22f1abbcb8219710d0c10a5b3756d0da392d4084b3b3a6157350776c596983e63def344f617d39964e91f244f60c07958695ee5c8c809a9f0f4
doc/containers/Containers/GraphSig/module-type-S/index.html
Module type GraphSig.SSource
Types
Type of graphs. Custom arbitrary data of type 'node_data and 'edge_data can be stored, respectively, in nodes and edges.
type node_id = P.NodeId.ttype edge_id = P.EdgeId.ttype port = P.Port.tExport back types from the functor parameter.
module NodeSet : SetExtSig.S with type elt = node_idmodule EdgeSet : SetExtSig.S with type elt = edge_idSets constructed from ordered type parameters.
module NodeMap : MapExtSig.S with type key = node_idmodule EdgeMap : MapExtSig.S with type key = edge_idMaps constructed from ordered type parameters.
Construction
val create : unit -> ('n, 'e) graphCreates an empty graph.
val add_node :
('n, 'e) graph ->
node_id ->
?inc:(port * ('n, 'e) edge) list ->
?out:(port * ('n, 'e) edge) list ->
?entry:port ->
?exit:port ->
'n ->
('n, 'e) nodeAdds a node to the graph. Optionally connects the node to incoming or outgoing edges. Optionally sets as an entry or exit node on a port (defaults to None, i.e., not entry nor exit). The node identifier must be unique among the node in the graph; raises Invalid_argument otherwise.
val add_edge :
('n, 'e) graph ->
edge_id ->
?src:(port * ('n, 'e) node) list ->
?dst:(port * ('n, 'e) node) list ->
'e ->
('n, 'e) edgeAdds an edge to the graph. Optionally connects the edge to source or destination nodes. The edge identifier must be unique among the edges in the graph; raises Invalid_argument otherwise.
Removes a node if it exists in the graph; otherwise, do nothing. All connections to incoming and outgoing edges are removed.
Removes an edge if it exists in the graph; otherwise, do nothing. All connections to source and destination nodes are removed.
Sets whether a node is an entry node on some port, or not (None). A given node can be entry for a single port at a time; previous entry ports are removed.
Sets whether a node is an exit node on some port, or not (None). A given node can be exit on a single port at a time; previous exit ports are removed.
Adds an incoming edge to the node, on the given port. A node can be connected to the same edge several times, on different or equal ports. Use the _unique version to ensure that a node is connected to an given edge on a given port only once.
Adds an outgoing edge to the node, on the given port.
Adds incoming edges to the node, on the given ports.
Adds outgoing edges to the node, on the given ports.
Adds a source node to the edge, on the given port.
Adds a destination node to the edge, on the given port.
Adds source nodes to the edge, on the given ports.
Adds destination nodes to the edge, on the given ports.
Adds an incoming edge to the node, on the given port, but only if not already present on this port. Does not prevent the node to be connected to the edge on other ports.
Adds an outgoing edge to the node, on the given port, but only if not already present on this port.
Adds incoming edges to the node, on the given ports, but only if not already present on this port.
Adds outgoing edges to the node, on the given ports, but only if not already present on this port.
Adds a source node to the edge, on the given port, but only if not already present on this port.
Adds a destination node to the edge, on the given port, but only if not already present on this port.
Adds source nodes to the edge, on the given ports, but only if not already present on this port.
Adds destination nodes to the edge, on the given ports, but only if not already present on this port.
Removes all the connections to the node incoming from the edge on the given port. No edge nor node is deleted.
Removes all the connections from the node outgoing into the edge on the given port. No edge nor node is deleted.
Removes all the connections to the node incoming into from the edge, on all ports. No edge nor node is deleted.
Removes all the connections from the node incoming into the edge, on all ports. No edge nor node is deleted.
val node_remove_all_in : ('n, 'e) node -> unitRemoves all the connections incoming into the node, for all edges and ports. No edge nor node is deleted.
val node_remove_all_out : ('n, 'e) node -> unitRemoves all the connections outgoing from the node, for all edges and ports. No edge nor node is deleted.
Removes all the connections to the edge from the node on the given port. No edge nor node is deleted.
Removes all the connections from the edge to the node on the given port. No edge nor node is deleted.
Removes all the connections to the edge from the node, on all ports. No edge nor node is deleted.
Removes all the connections from the edge to the node on all ports. No edge nor node is deleted.
val edge_remove_all_src : ('n, 'e) edge -> unitRemoves all the connections at the source of the edge, for all nodes and ports. No edge nor node is deleted.
val edge_remove_all_dst : ('n, 'e) edge -> unitRemoves all the connections at the destination of the edge, for all nodes and ports. No edge nor node is deleted
Sets the incoming edges to the node, on the given ports.
Sets the outgoing edges to the node, on the given ports.
Sets the source nodes to the edge, on the given ports.
Sets destination nodes to the edge, on the given ports.
Sets the incoming edges to the node, on the given ports.
Sets the outgoing edges to the node, on the given ports.
Sets the source nodes to the edge, on the given ports.
Sets destination nodes to the edge, on the given ports.
Exploration
The set of nodes in the graph as a map from identifiers to nodes.
The set of edges in the graph as a map from identifiers to edges.
Whether the graph contains a node with this identifier.
Whether the graph contains an edge with this identifier.
The node corresponding to the identifier in the graph. Raises Not_found if has_node is false.
The edge corresponding to the identifier in the graph. Raises Not_found if has_edge is false.
val edge_data : ('n, 'e) edge -> 'eGets custom data associated to the edge.
val edge_set_data : ('n, 'e) edge -> 'e -> unitSets custom data associated to the edge.
List of edge source nodes on the given port.
List of edge destination nodes on the given port.
val edge_src_size : ('n, 'e) edge -> intNumber of edge source nodes.
val edge_dst_size : ('n, 'e) edge -> intNumber of edge destination nodes.
Number of edge destination nodes on the given port.
val node_data : ('n, 'e) node -> 'nGets custom data associated to the node.
val node_set_data : ('n, 'e) node -> 'n -> unitSets custom data associated to the node.
List of edges incoming into the node on the given port.
List of edges outgoing from the node on the given port.
val node_in_size : ('n, 'e) node -> intNumber of edges incoming into the node.
val node_out_size : ('n, 'e) node -> intNumber of edges outgoing from the node.
Number of edges incoming into the node on the given port.
Number of edges outgoing from the node on the given port.
If the node is an entry node, returns its port, otherwise None.
If the node is an exit node, returns its port, otherwise None.
Whether the given edge is outgoing from the node.
Whether the given edge is outgoing from the node on the given port.
Whether the given edge is incoming into the node.
Whether the given edge is incoming into the node on the given port.
Whether the edge has the node as source on the given port.
Whether the edge has the node as destination.
Whether the edge has the node as destination on the given port.
Successors nodes of a given node. Each returned element (port1,edge,port2,node) gives the port port1 connecting the argument node to an edge edge, the edge edge, the port port2 connecting the edge edge to the successor node node, and finally the successor node node.
Predecessor nodes of a given node. Each returned element (node,port1,edge,port2) gives the predecessor node node, the port port1 connecting it to an edge edge, the edge edge, and finally the port port2 connecting the edge edge to the argument node.
Successor nodes of a given node connected through an edge on the specified ports. node_out_nodes_port node port1 port2 returns a list of (edge,node') elements, where port1 connects the argument node to an edge edge and port2 connects the edge edge to a successor node node'.
Predecessor nodes of a given node connected through an edge on the specified ports. node_in_nodes_port node port1 port2 returns a list of (node',edge) elements, where port1 connects the predecessor node' to an edge edge and port2 connects the edge edge to a the argument node node.
Whether the first node has an outgoing edge into the second node.
Whether the first node has an incoming edge from the second node.
Whether the first node has an outgoing edge on the first port, going into the second node on the second port.
Whether the first node has an incoming edge on the first port, coming from the second node on the second port.
Maps and folds
Creates a copy of the graph, applying a function to each node data and each edge data.
val transpose : ('n, 'e) graph -> unitReverses the direction of all edges. Also switches entry and exit nodes.
Iterates a function on all nodes. The order in which the function is called is not specified.
Iterates a function on all edges. The order in which the function is called is not specified.
Constructs a map from node identifiers, applying the given function. The order in which the function is called is not specified.
Constructs a map from edge identifiers, applying the given function. The order in which the function is called is not specified.
Accumulates a function on all nodes. The order in which the function is called is not specified.
Accumulates a function on all edges. The order in which the function is called is not specified.
Iterates a function on all nodes. The function is called in increasing identifier order.
Iterates a function on all edges. The function is called in increasing identifier order.
Constructs a map from node identifiers, applying the given function. The function is called in increasing identifier order.
Constructs a map from edge identifiers, applying the given function. The function is called in increasing identifier order.
Accumulates a function on all nodes. The function is called in increasing identifier order.
Accumulates a function on all edges. The function is called in increasing identifier order.
Simplification
val remove_orphan : ('n, 'e) graph -> unitRemoves orphan nodes and edges. Orphan nodes have no incoming nor outgoing edges, and orphan edges have no source nor destination nodes.
Topological ordering
val weak_topological_order : ('n, 'e) graph -> ('n, 'e) node nested_list listComputes a weak topological ordering suitable to perform fixpoint iterations with widening. Implements Bourdoncle's algorithm 1. 1 Francois Bourdoncle. Efficient Chaotic Iteration Strategies With Widenings. In Proc. FMPA'93, 128-141, 1993. Springer.
val widening_points : ('n, 'e) node nested_list list -> ('n, 'e) node listReturns an adminisible list of widening points. Given a weak topological ordering, we compute the head of every component.
Printing
Print in plain text.
type ('n, 'e) printer = {print_node : Stdlib.Format.formatter -> ('n, 'e) node -> unit;print_edge : Stdlib.Format.formatter -> ('n, 'e) edge -> unit;print_src : Stdlib.Format.formatter -> ('n, 'e) node -> port -> ('n, 'e) edge -> unit;print_dst : Stdlib.Format.formatter -> ('n, 'e) edge -> port -> ('n, 'e) node -> unit;print_entry : Stdlib.Format.formatter -> ('n, 'e) node -> port -> unit;print_exit : Stdlib.Format.formatter -> ('n, 'e) node -> port -> unit;
}Print in dot graph format.
type ('n, 'e) dot_printer = {dot_pp_node : Stdlib.Format.formatter -> ('n, 'e) node -> unit;dot_pp_edge : Stdlib.Format.formatter -> ('n, 'e) edge -> unit;dot_pp_port : Stdlib.Format.formatter -> port -> unit;dot_filter_node : ('n, 'e) node -> bool;dot_filter_edge : ('n, 'e) edge -> bool;dot_filter_port : port -> bool;
}val print_dot :
('n, 'e) dot_printer ->
string ->
Stdlib.Format.formatter ->
('n, 'e) graph ->
unitprint_dot channel graph name printer. outputs the graph in the specified channel in dot format. In addition name gives the dot graph name. The node, edge and port printer functions are user-specified.