Navigation

A Tulip graph contains a lot of visual attributes that can be freely
modified from Python. These attributes are used by the Tulip software
when rendering the graph. Below is an exhaustive list of these attributes :

The layout of the graph can be modified through the use of the “viewLayout” graph property (of type tlp.LayoutProperty).
The position of a node is defined by a 3d point (of type tlp.Coord). Bends (or curve control points) can also be set
on the edges through a list of 3d points.

Elements of the graph can be marked in a selected state. These elements will be highlighted in the Tulip viusalizations.
The current selection is stored in the “viewSelection” graph property (of type tlp.BooleanProperty).

The sample code below select nodes whose degree is greater than 3 and the edges between the selected nodes:

The colors of nodes and edges can be modified through the “viewColor” and “viewBorderColor” graph properties (of type tlp.ColorProperty).
The colors of nodes and edges labels can be modified through the “viewLabelColor” graph property.
The colors must be given in RGBA format through an instance of the tlp.Color class.

The sample code below colors nodes whose degree is greater than 3 in blue and the others in green:

The display sizes of the graph elements can be modified through the use of the “viewSize” graph property (of type tlp.SizeProperty).
The display sizes of the edge extremities can also be modified through the “viewSrcAnchorSize” and “viewTgtAnchorSize” graph properties.
The width, height and depth of an element must be given through an instance of the tlp.Size class.

The shape of nodes and edges can be modified through the use of the “viewShape” graph property (of type tlp.IntegerProperty).
Some predefined constants are available for code readability (shapes are defined by integers in Tulip).

Below is the exhaustive list of the constants for nodes shapes:

tlp.NodeShape.Billboard

tlp.NodeShape.ChristmasTree

tlp.NodeShape.Circle

tlp.NodeShape.Cone

tlp.NodeShape.Cross

tlp.NodeShape.Cube

tlp.NodeShape.CubeOutlined

tlp.NodeShape.CubeOutlinedTransparent

tlp.NodeShape.Cylinder

tlp.NodeShape.Diamond

tlp.NodeShape.GlowSphere

tlp.NodeShape.HalfCylinder

tlp.NodeShape.Hexagon

tlp.NodeShape.Pentagon

tlp.NodeShape.Ring

tlp.NodeShape.RoundedBox

tlp.NodeShape.Sphere

tlp.NodeShape.Square

tlp.NodeShape.Triangle

tlp.NodeShape.Window

Below is the exhaustive list of the constants for edges shapes:

tlp.EdgeShape.Polyline

tlp.EdgeShape.BezierCurve

tlp.EdgeShape.CatmullRomCurve

tlp.EdgeShape.CubicBSplineCurve

The shape of the edge extremities can also be modified through the “viewSrcAnchorShape” and “viewTgtAnchorShape” graph properties.
Constants are also available for code readability, here is the exhaustive list :

tlp.EdgeExtremityShape.None

tlp.EdgeExtremityShape.Arrow

tlp.EdgeExtremityShape.ChristmasTree

tlp.EdgeExtremityShape.Circle

tlp.EdgeExtremityShape.Cone

tlp.EdgeExtremityShape.Cross

tlp.EdgeExtremityShape.Cube

tlp.EdgeExtremityShape.Cylinder

tlp.EdgeExtremityShape.Diamond

tlp.EdgeExtremityShape.GlowSphere

tlp.EdgeExtremityShape.HalfCylinder

tlp.EdgeExtremityShape.Hexagon

tlp.EdgeExtremityShape.Pentagon

tlp.EdgeExtremityShape.Ring

tlp.EdgeExtremityShape.Sphere

tlp.EdgeExtremityShape.Square

tlp.EdgeExtremityShape.Triangle

The sample code below set the shape of the selected nodes to a circle:

The labels associated to graph elements can modified through the “viewLabel” graph property (of type tlp.StringProperty).
The font used to render the labels can be modified through the “viewFont” graph property (of type tlp.StringProperty).
A font is described by a path to a TrueType font file (.ttf).

The position of the label relative to the associated elements can also be modified through the “viewLabelPosition” graph property (of type tlp.IntegerProperty).
Constants are defined for code readability, below is the exhaustive list:

A texture can be applied when Tulip renders the graph elements. Setting a texture to graph elements can be done through
the “viewTexture” graph property (of type tlp.StringProperty).
A texture is described by a path to an image file. Note that the image must have the same width and height for
correct texture loading.