Global Procedures

We use Global Procedures on a graph in order to make changes to it by using the graph’s nodes and edges. The procedures allow for retyping, merging, copying and other similar operations.

List of Global Procedures

Here you can find a list that contains all of the global procedures in Soley Studio. Furthermore, on the right hand side of the table you will find the descriptions.

SyntaxDescription
add(NodeType):(Node)Adds a new node of the given node type to the host graph, returns the added node.
add(EdgeType,Node,Node):(Edge)Adds a new edge of the given edge type to the host graph, in between the source node specified as second argument and the target node specified as third argument, returns
the added edge.
addCopy(Edge, Node, Node):(Edge)Adds a clone of the original edge to the host graph, in between the source node specified
as second argument and the target node specified as third argument, returns the added
edge.
addCopy(Node):(Node)Adds a clone of the original node to the host graph, returns the added node.
clear()Clears the host graph.
emit(string(,string)*)Writes the argument value, or the comma separated list of argument values, to stdout, or to a file if output was redirected. The argument(s) must be of string type, but any type is
automatically casted into its string representation as needed. Prefer comma separated arguments over string concatenation, they are are more efficient as no intermediate strings need to be computed, just to be garbage collected thereafter.
insert(graph)Inserts a given subgraph to the current host graph (disjoint union of the nodes and edges); the original graph is destroyed by this (move semantics).
insertCopy(graph,Node):(Node)Inserts a clone of the given subgraph to the current host graph (disjoint union of the nodes and edges); the original subgraph stays untouched. Returns the copy of the node
given as second argument from the host graph.
insertDefined(set,Edge):(Edge)Adds a clone of the subgraph defined (edge-induced) by the set of edges given as first
argument to the host graph, returns the clone of the anchor edge given as second argument.
insertInduced(set, Node):(Node)Adds a clone of the subgraph induced by the set of nodes given as first argument to the
host graph, returns the clone of the anchor node given as second argument.
merge(Node, Node)Merges the source node given as second argument into the target node given as first argument.
record(string)Writes the argument value, typically a text string, to the graph change record.
redirectSource(Edge,Node)Redirects the edge given as first argument to the new source node given as second argument.
redirectSourceAndTarget(Edge, Node, Node)Redirects the edge given as first argument to the new source node given as second argument and the new target node given as third argument.
redirectTarget(Edge,Node)Redirects the edge given as first argument to the new target node given as second argument.
rem(Edge)Removes the given edge from the host graph (no expression, does not return anything).
rem(Node)Removes the given node from the host graph (no expression, does not return anything).
retype(Edge, EdgeType):(Edge)Retypes the given edge to the edge type given as second argument,
returns the retyped entity.
retype(Node, NodeType):(Node)Retypes the given node to the node type given as second argument,
returns the retyped entity.
valloc():(int)Allocates space for a visited flag in the elements of the graph and returns
the id of the visited flag (integer number), starting at 0. Afterwards, the visited flag of the id can be read and written by the visited-expression and the visited-assignment.
vfree(int) frees the space previously allocated for the visited flag; afterwards you must
not access it anymore. The value passed in vfree(IntExpr) must be of integer type, stemming from a previous allocation. This function internally calls a vreset to ensure that no corresponding visited flag is set in the graph.
vfreeonreset(int)The space previously allocated for the visited flag is freed, too,
but the implicit internal vreset(id) of vfree is not executed. It is your duty to ensure
the flag is false in all graph elements – otherwise after a following allocation elements
may start as being marked.
vreset(int)Resets the visitor flag given by the flag id variable in all graph elements.

Was this article helpful?

Related Articles