
Copyright © 2009 Tomaz Canabrava
Rocs is a graph theory viewer tool for KDE.
Table of Contents

Rocs aims to be a Graph Theory IDE for helping professors to show the results of a graph algorithm and also helping students to do the algorithms.
Rocs has a scripting module, done in Qt Script, that interacts with the drawn graph and every change in the graph with the script is reflected on the drawn one.

The user interface is divided in two parts:
the top right part is where you draw your graphs, and the bottom right one is where you create your algorithms,
the left sidebar is where all your open graphs stay, you can open multiple graphs per file.
On the left sidebar you can find the options for each opened graph, all these options are global per graph and can be changed per node and edge with the Node Properties and the Edge Properties dialogs.
Graph Name
Node Color for new created nodes, you can change the node color for all current nodes by clicking the All button
Edge Color
The last row of options consists in toggled buttons:
Oriented Graph
Automated Graph
Show nodes names
Show edges names
Show nodes values
Show edges values

There are two toolbars, on the top. The main one has the following tools:
Move Node: moves a node around the drawing area.
Add Node: creates a new node at the clicked position on the drawing area.
Add Edge: creates a new edge between two nodes.
Select: select items by clicking on them.
Delete: delete items by clicking on them.
A right mouse click on a node or edge brings you the property dialog for that node or edge.
The layout toolbar consists in various aligns icons.
To align nodes, choose the Select tool, click and drag a rectangle, then choose the alignement that you want.

After the graph is on screen, you can start creating the script for it. The language uses a Javascript syntax and following are the Graph, Node and Edge objects.
array list_nodes(); array list_edges(); node add_node(name); edge add_edge(from, to); node node_byname(QString& name); node begin_node(); array end_nodes();
Graph variables that can be changed:
bool directed bool automate string name string nodeDefaultColor // in HEXA string edgeDefaultColor // in HEXA

Here is a simple script example that sets the color of the 4 first nodes in the first graph:
/* A simple example that sets the color of the 4 first nodes in the first graph: */ var colours = new Array("red", "green", "blue", "yellow"); /* graphs is an array of graphs, you can access a graph by its index in the array or by its name, so if the first graph's name is Untitled0, the following sentence are right */ var list1= graphs[0].list_nodes(); // 1st form. var list2=Untitled0.list_nodes(); // 2nd form for ( var i = 0; i < colours.length; i++){ if (i > list2.length) break; list2[i].color = colours[i] }

- ->
Toggle the , and toolbars.
- ->
Toggle the statusbar.
- ->
Open standard KDE setting dialog that allows you to choose different shortcut keys for different actions.
- ->
Configure the items you want to put in the toolbar.
- -> (F1)
Invokes the KDE Help system starting at the Rocs help pages. (this document).
- -> (Shift+F1)
Changes the mouse cursor to a combination arrow and question mark. Clicking on items within Rocs will open a help window (if one exists for the particular item) explaining the item's function.
- ->
Opens the Bug report dialog where you can report a bug or request a “wishlist” feature.
- ->
Opens a dialog where you can edit the Primary language and Fallback language for this application.
- ->
This will display version and author information.
- ->
This displays the KDE version and other basic information.

Rocs
Program copyright 2009 Tomaz Canabrava tcanabrava at kde dot org
Documentation copyright 2009 Anne-Marie Mahfouf (annma AT kde.org)
and Tomaz Canabrava tcanabrava at kde dot org
This documentation is licensed under the terms of the GNU Free Documentation License.
This program is licensed under the terms of the GNU General Public License.

Table of Contents
Rocs is part of the KDE project http://www.kde.org/.
Rocs can be found in the kdeedu package on ftp://ftp.kde.org/pub/kde/, the main FTP site of the KDE project.

For detailed information on how to compile and install KDE applications see Building KDE4 From Source
Since KDE uses cmake you should have no trouble compiling it. Should you run into problems please report them to the KDE mailing lists.