4. Properties

The Tulip property enables to store attribute on the elements of a graph. In Tulip we call it Property in order to prevent confusion with the graph attribute. Thus, the properties are for the elements and attributes are for the graphs. The main idea in Tulip is that a property is always define for all kind (node and edge) of elements in the graph. Thus we can always query for an edge or node property associated value.

As for the graph structure, to access the value of an elements one must query a property. This characteristic makes the use of the library a little bit less intuitive but, it enables to store efficiently the properties.

In general properties can be seen as an associative table where you can set or get the value of an element. In order to prevent having a lot of cast in the code all the properties have type and thus there is no need to cast your result when you query a property. The standard operations of a property are given below :

List of available modification operations

List of available access operations

For each kind of properties it exists a specific implementation (inheritance) that enables to obtain specific operations (see developer documentation) depending of the Type. For instance, it is possible to obtain the maximum value of a property if the property type is double.

One of the most important things is to know how to create a property or to access to an existing property in the graph. To do this a graph includes a set of functions that enables to obtain/create/delete a Property. Because the C++ signature of function does not include the TYPE of the returned argument, the syntax for this call is not very simple. For instance, if one wants to obtain a property containing double (called MetricProxy in Tulip) one must use the following syntax : MetricProxy *metric=graph->getProperty<MetricProxy>("name of the property"); In the graph each property is identified by its name which a std::string, when one asks for a property the type of this property is checked using the run time type interrogation mechanism of the C++. Warning, this test is only done when one compiles its sources in DEBUG mode (default mode). In order to facilitate the navigation/edition of the set of properties, a set of function is accessible through the graph interface.

List of available operations

The mechanism described above works well for graphs. However, in Tulip we are working with a hierarchy of graphs. Thus a special mechanism have been added in order to share easily properties between graphs. This mechanism use the fact that if a property exists in an ancestor of a graph, it can be use on the graph. This looks like an inheritance mechanism of properties between graphs. As in object oriented language, in Tulip, it is possible to inherit a property or to have it defined locally. In order to facilitate the navigation/edition of the set of properties, a set of function is accessible through the graph interface.

List of available operations