3. Properties of graph
Prev | Chapter 3. Functionalities | Next

## 3. Properties of graph

In Tulip, there is a way to assign properties to each node or edge of the graph. Tulip defines two kinds of property : intrinsic and extrinsic. The first represents the properties computed relatively to the structure of graphs. But it is possible to assign values to the nodes or the edges that are not related to the structure. For example, if we build the map of a region and the nodes represent the towns, the label property can be used for the name of town. But it is not possible to determine the name with the structure of the graph; this kind of property is extrinsic.

For each graph, Tulip provides a set of properties used by the renderer engine ; all begin with the “view” prefix by convention : viewColor, viewLabel, viewLayout... They are updated during the computation phase of the plugins. In the other hand, it is possible to define properties to store informations relative to the graph. The number of this created properties are not limited.

### Rendering Properties

Following is the list of rendering properties :

- `viewBorderColor :` Color of the border of an edge or a node.

- `viewBorderWidth :` Width of the border of an edge or a node.

- viewColor : color of an edge or a node.

- `viewLabel :` Label of an edge or a node.

- `viewLabelColor :` Color label of an edge or a node.

- `viewLabelPosition :` Label position (x,y,z) of an edge or a node.

- `viewLayout :` Position (x,y,z) of a node, or vector of the bends positions of the edges.

- `viewMetric :` Result value of the last measure ( the section called “Measure” ) algorithm applied.

- `viewRotation :` Rotation (0 to 360) of a node or an edge

- `viewSelection :` Selection equals true if the node or edge is selected. False if it is not.

- `viewShape :` Shape of a node or a graph.

- `viewSize :` Size (height, width, depth) of a node or an edge. To re-size an edge, the parameter "Size Interpolation" (CONTROL+R) must be switched off. For an edge, the three fields are : Width at source of the edge, Width at the end of the edge, Size of the arrow.

- `viewTexture :` Texture will replace the color background of the node.

### Using Properties

#### Updates of property values

As it is explained in the last section, it is possible to update the properties attached to the graph elements with algorithms. An other solution is to update the values through the `Property` tab of the `Info Editor` subwindow.

To give an example, create a graph :

- Select the property you want to update, `viewSize` in the `local` table, for example, to manage the size of the nodes. Now, you can change all values or the value of one node.

  1. Click on `Set all`, and write the new coordinates : `(2.0, 2.0, 2.0)`

  2. Click on the line and the second column of the choosed node in the table. Change the values for the `width`, the `height` and `depth`.

If you want to change properties of selected elements, use the check box `selected only` of the `Property` tab.

- Select elements with the mouse toolbar operation or using the 'Add/Remove Selection' item displayed in the contextual pop-up menu which appears when pressing on the mouse right button (press Ctrl key when mouse pressing on Mac).

- Select the property you want to modify : `viewLabel`.

- Click on the checkbox named `Filter`. The selected element just appears in the table above.

- Click on `Set all` and write the text you want to display : “Hey!”.

If you uncheck `selected only`, all nodes are in the table. It is possible to do the same thing with the values of edges. You just have to click on the tab named `Edges`. There is an other solution to modify the value of one node or edge :

- First select the mouse toolbar operation, then click on the node or edge you want to update.

- The `Element` tab of the `Info Editor` subwindow is then selected. It displays the informations of the element you clicked on.

#### Management of properties

The bottom of the `Property` subwindow enables to manage the properties. For each graph, as explain before, a set of display properties already exists. If you want to create a new property :

- Click on the `New` button.

- Select the type of property, `String`. (other possibilities are Color, Integer, Layout, Metric, Size, Selection)

- Type the name of the new Property (e.g. `mylabel`).

For removing a property, you just have to select the property and click on the button named `Remove`. When deleting properties used by the render engine, those properties will be temporary removed from the list but still continue to exist. Note that it is not possible to remove `inherited` properties.

The last feature is cloning property. Select the desired property and click on the button named `Clone`. Type the name you have chosen. The new property keeps the values.

#### Find : make a request.

The find tool is in the `Edit` menu. Make a graph with several nodes. Change some properties of node for making operations. Select nodes, check the `Filter` box and select the properties you want to change : `viewRotation`. Click on the `Set all` button and type a value (`20` for example). Now, you have some node with a rotation of 0 degree and some other rotated of 20. So in the Find box :

- Select the property used for the request : `viewRotation`.

- Choose the operation and type a value for the comparaisons : `=` and `20`, to find the element rotated of 20 degrees.

- Select the action in the `Options` part : `Add` and the kind of the elements of the request : `on nodes`.

Prev | Up | Next
2. Algorithms | Home | 4. Hierarchy