Rocs in a Nutshell

Every Rocs session is a project: when opening Rocs an empty project is created, when loading some project it becomes the current project. Hereby, a project itself consists of graph documents, scripts/algorithms, and a journal.

Graph Documents

A graph document represents the content of a whiteboard in the graph editor. It contains information about the user defined node and edge types, their properties, and about the already created nodes and edges. This is, Rocs understands the set of all nodes and edges of a graph document to form a (not necessarily connected) graph. Everything belonging to a graph document is accessible by the script engine via the global object Document.

Edge Types

In some scenarios, graphs consist of different types of edges (e.g., an undirected graph plus the tree edges computed by a breadh-first-search algorithm) that shall be handled and displayed differently. For this, besides a default edge type, you can define arbitrary other edge types. Each edge type has its individual visual representation, dynamic properties, and can be set to be either undirected or directed. The scripting interface provides convenience methods to specifically access only edges of specific types.

Node Types

Analog to edge types, you can define different types of nodes of a graph (e.g., to give some nodes special roles). Each node type has its own visual representation and dynamic properties.

Properties

Every (node or edge) element can have properties. Those properties must be setup at the corresponding node or edge type. Properties are identified and accessed by their names and can contain any value. To create new or change existing properties, use the Element Types sidebar and use the Properties button to open the property dialog.

You can also use the scripting engine to access registered properties and change their values. In the following example we assume that the property "weight" is registered for the default edge type.

var nodes = Document.nodes()
for (var i = 0; i < nodes.length; ++i){
    nodes[i].weight = i;
}
for (var i = 0; i < nodes.length; ++i){
    Console.log("weight of node " + i + ": " + nodes[i].weight);
}