Manual

Main Concepts Visualization Definition

# Visualization Definition

Rules from a visualization definition are used to define the visual appearance for a family of graphs. With visualization rules, you can control the default visualization for a subset of nodes and edges in order to manage this at a central place. For example, you can specify a rule to draw all nodes of some arbitrary type X with a red circle, instead of using attributes for each individual node of a graph. The modification of a rule affects all elements of the same node type in a graph at the same time. So, the central visualization definition is a comfortable method to define a universal visualization for a family of graphs. Please refer to API command category Visual for technical information.

## Setting Rules

One visualization rule is a list of attributes (keys and values) for a specified type. The rule is used for all nodes/edges with this particular type and usually only for the attributes that are not locally defined in the nodes/edges with that type (but read about the attribute evaluation order below). The rules are set with API command visual(new_rules()) and visual(add_rules()).

## Overriding Rules with individual Attributes

When a node or edge has a type and there is a visualization rule defined for that type, you can override the corresponding rule by setting individual local attributes in the particular node or edge. Use API command graph(change_attr()) to set individual attributes. To remove an individual attribute in order to reset to the attribute value from the visualization rule, simply set the individual attribute value to an empty string ("") with API command graph(change_attr())

## Attribute Evaluation Order

When no visualization definition is present, the visualization style is determined by the individual attribute settings of the nodes and edges (color, pattern, line thickness etc). When an individual attribute is not set, an internal default value is taken. But when rules of a visualization definition are present, the attribute evaluation order is modified. First the value of the attribute of the individual node or edge is considered. If an individual attribute is not present, the corresponding rule for the type of the node or edge is applied. If a rule is present and the attribute is defined in that rule, the value is taken from the visualization definition, otherwise the default value is used.

In a graph where each node and edge has its own attributes, it would be impossible to use visualization definitions. So it is possible to control the attribute evaluation with the API command set(rules_first(...).

Next: Fine-Tuning of a Layout.