Appends the selected part of a graph (properties, nodes and edges) into another one.
If no selection is done, the whole input graph graph is appended.
The output selection is used to select the appended nodes & edges

Returns the average path length of a graph, that is the sum
of the shortest distances for all pair of distinct nodes in that graph
divided by the number of those pairs. For a pair of non connected nodes,
the shorted distance is set to 0.

Parameters:

graph (tlp.Graph) – the graph on which to compute the average path length

Assigns to each node its local clustering coefficient
that is the proportion of edges between the nodes within its neighbourhood
divided by the number of edges that could possibly exist between them.
This quantifies how close its neighbors are to being a clique.

Parameters:

graph (tlp.Graph) – the graph on which to compute the clustering coefficient for each node

root (tlp.node) – The node from whom to start the BFS. If not provided, the root node will be assigned to a source node in the graph (node with input degree equals to 0). If there is no source node in the graph, a random node will be picked.

root (tlp.node) – The node from whom to start the DFS. If not provided, the root node will be assigned to a source node in the graph (node with input degree equals to 0). If there is no source node in the graph, a random node will be picked.

Computes the bounding box of a graph according to nodes positions and edges bends defined in the default layout property “viewLayout”,
nodes z-rotations defined in the default double property “viewRotation” and sizes of elements defined in the default size property “viewSize”.

Computes a bounding sphere (or a bounding circle if the graph has a 2D layout) of a graph according to nodes positions and edges bends
defined in the default layout property “viewLayout”, nodes z-rotations defined in the default double property “viewRotation”
and sizes of elements defined in the default size property “viewSize”.

Returns a tuple of tlp.Coord whose first member is the center of the bounding sphere (circle for 2D layout)
and second member is the farthest point from the center (computed from graph elements positions).
To get the bounding radius, you have to compute the distance between the two members of the tuple
(use the tlp.Vec3f.dist() method).

Computes a bounding sphere (or a bounding circle if the graph has a 2D layout) of a graph according to node position edge bends
node z-rotation, and size of elements.

Returns a tuple of tlp.Coord whose first member is the center of the bounding sphere (circle for 2D layout)
and second member is the farthest point from the center (computed from graph elements positions).
To get the bounding radius, you have to compute the distance between the two members of the tuple
(use the tlp.Vec3f.dist() method).

Computes a convex hull of a graph according to nodes positions and edges bends
defined in the default layout property “viewLayout”, nodes z-rotations defined in the default double property “viewRotation”
and sizes of elements defined in the default size property “viewSize”. Only works with 2D layouts.
Returns a list of tlp.Coord containing the vertices of the graph convex hull correctly ordered.

Computes a convex hull of a graph according to nodes positions, edges bends,
nodes z-rotations, and sizes of elements. Only works with 2D layouts.
Returns a list of tlp.Coord containing the vertices of the graph convex hull correctly ordered.

Computes the 2D convex hull of a list of points (the z-coordinate is not taken into acccount)
using the Qhull library.
Returns a list of indexes in the list of points defining the hull polygon in counterclockwise order.

Parameters:

points (list of tlp.Coord) – the points on which to compute the 2D convex hull

Computes the 2D/3D convex hull of a list of points using the Qhull library.
Returns a tuple whose first member is the list of facets defining the
convex hull (segments for 2D, triangles for 3D) and second member is the list
of neighbors facets for each facet. A facet is defined by a list of indexes
in the list of points. The ith element of the neighbors list is a list
of indexes in the facets list corresponding to the neighbors facets of the ith facet.

Parameters:

points (list of tlp.Coord) – the points on which to compute the 2D/3D convex hull

Computes the intersection point (if any) of two 3d lines.
Returns a tuple whose first member is a boolean indicating
if the lines intersect (if False it means that lines are parallel or skew)
and second member is the intersection point (if any).

Parameters:

line1 ((tlp.Coord , tlp.Coord)) – the coordinates of the two points defining the first line

line2 ((tlp.Coord , tlp.Coord)) – the coordinates of the two points defining the second line

Computes the delaunay triangulation of a set of points and returns the set of delaunay edges and simplices (triangles in 2d, tetrahedra in 3d).
Returns a tuple whose first member is the list of edges and second member is the list of simplices, or None if
the triangulation failed.
Edges and simplices are defined using indexes into the original list of points.

Parameters:

points (list of tlp.Coord) – a list of points on which to compute a delaunay triangulation

Computes the voronoi diagram of a set of sites (for 2d and 3d layouts).
It automatically computes the set of all voronoi
vertices, edges and cells. In order to not have to deal with infinite
voronoi rays, the input layout is enclosed in its convex hull in 2d or
in its bounding box in 3d. It enables to have a connected voronoi cell
for each input site.

Parameters:

sites (list of tlp.Coord) – the sites from which to compute the voronoi diagram

Looks for the Tulip plugins directory and fills the Tulip path variables : tlp.TulipLibDir, tlp.TulipPluginsPath, tlp.TulipBitmapDir.
The plug-ins directory can be defined in different ways, given by order of prevalence:

the TLP_DIR environment variable, if it has a value

the appDirPath parameter, if it is not NULL

at that point, the Tulip paths will be retrieved from the path of the loaded Tulip shared library
(you must dispose of a standard Tulip installation for that feature to work,
meaning the relative path for the Tulip plugins folder to the Tulip libraries one must be ../lib/tulip/).

a fallback value of ‘C:/Tulip/lib/’ on windows, or ‘/usr/local/lib/’ on Unix.

Loads C++ plugins installed in the directories listed in the tlp.TulipPluginsPath variable
(in the form “<path1>;<path2>” on windows and “<path1>:<path2>” on unix).
The tlp.TulipPluginsPath can be initialized with standard Tulip directories
by calling the tlp.initTulipLib() function.

Return a list containing the names of the import plugins (written in C++ or Python) loaded so far.
Import plugins are objects implementing the tlp::ImportModule interface
in C++ or the tlp.ImportModule interface in Python.

Return a list containing the names of the export plugins (written in C++ or Python) loaded so far.
Export plugins are objects implementing the tlp::ExportModule interface
in C++ or the tlp.ExportModule interface in Python.

Return a list containing the names of the algorithm plugins (written in C++ or Python) loaded so far.
Algorithm plugins are objects implementing the tlp::Algorithm interface
in C++ or the tlp.Algorithm interface in Python.

Return a list containing the names of the boolean algorithm plugins (written in C++ or Python) loaded so far.
Boolean algorithm plugins are objects implementing the tlp::BooleanAlgorithm interface in C++ or
the tlp.BooleanAlgorithm interface in Python.

Return a list containing the names of the color algorithm plugins (written in C++ or Python) loaded so far.
Color algorithm plugins are objects implementing the tlp::ColorAlgorithm interface in C++ or
the tlp.ColorAlgorithm interface in Python.

Return a list containing the names of the double algorithm plugins (written in C++ or Python) loaded so far.
Double algorithm plugins are objects implementing the tlp::DoubleAlgorithm interface in C++ or
the tlp.DoubleAlgorithm interface in Python.

Return a list containing the names of the integer algorithm plugins (written in C++ or Python) loaded so far.
Integer algorithm plugins are objects implementing the tlp::IntegerAlgorithm interface in C++ or
the tlp.IntegerAlgorithm interface in Python.

Return a list containing the names of the layout algorithm plugins (written in C++ or Python) loaded so far.
Layout algorithm plugins are objects implementing the tlp::LayoutAlgorithm interface in C++ or
the tlp.LayoutAlgorithm interface in Python.

Return a list containing the names of the size algorithm plugins (written in C++ or Python) loaded so far.
Size algorithm plugins are objects implementing the tlp::SizeAlgorithm interface in C++ or
the tlp.SizeAlgorithm interface in Python.

Return a list containing the names of the string algorithm plugins (written in C++ or Python) loaded so far.
String algorithm plugins are objects implementing the tlp::StringAlgorithm interface in C++ or
the tlp.StringAlgorithm interface in Python.

Deletes edges in the graph. These edges are also removed in
the sub-graphs hierarchy of the current graph to maintain
the sub-graph relation between graphs.
The ordering of remaining edges is preserved.

Parameters:

itEdges (a Tulip iterator on tlp.edge objects) – an iterator on the edges to delete

deleteInAllGraphs – If True, the edges are deleted in the whole hierarchy of graphs.

deleteInAllGraphs – boolean

Throws :

an exception if one of the edge to delete is not an element of the graph

Creates and returns a new sub-graph of the graph induced by a set of nodes.
The sub-graph contains all the nodes of the set and all the existing edges
between two nodes of the set including self-loops.

Parameters:

nodeSet (list or set of tlp.node) – the set of nodes from which to build the induced sub-graph

root (tlp.node) – The node from whom to start the BFS. If not provided, the root node will be assigned to a source node in the graph (node with input degree equals to 0). If there is no source node in the graph, a random node will be picked.

root (tlp.node) – The node from whom to start the DFS. If not provided, the root node will be assigned to a source node in the graph (node with input degree equals to 0). If there is no source node in the graph, a random node will be picked.

Returns the boolean property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the boolean property to return or to create

Returns the boolean property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the boolean property to return or to create

Returns the boolean vector property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the boolean vector property to return or to create

Returns the boolean vector property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the boolean vector property to return or for n in graph.getNodes():
print nto create

Returns the color property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Returns the color property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Returns the color vector property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the color vector property to return or to create

Returns the color vector property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the color vector property to return or to create

Returns the double property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the double property to return or to create

Returns the double property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the double property to return or to create

Returns the double vector property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the double vector property to return or to create

Returns the double vector property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the double vector property to return or to create

Returns the integer property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the integer property to return or to create

Returns the integer property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the integer property to return or to create

Returns the integer vector property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the integer vector property to return or to create

Returns the integer vector property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the integer vector property to return or to create

Returns the meta-graph property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the meta-graph property to return or to create

Returns the meta-graph property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the meta-graph property to return or to create

Returns the layout property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the layout property to return or to create

Returns the layout property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the layout property to return or to create

Returns the coord vector property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the coord vector property to return or to create

Returns the coord vector property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the coord vector property to return or to create

Returns the size property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Returns the size property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Returns the size vector property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the size vector property to return or to create

Returns the size vector property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the size vector property to return or to create

Returns the string property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the string property to return or to create

Returns the string property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the string property to return or to create

Returns the string vector property associated to name in the graph properties pool or in the pool of an ancestor in the sub-graphs hierarchy.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the string vector property to return or to create

Returns the string vector property associated to name in the graph properties pool.
If the property is not registered in the pool, it creates a new one and returns it.
Using of del on that property will cause a segmentation violation (use tlp.Graph.delLocalProperty() instead).

Parameters:

name (string) – the name of the string vector property to return or to create

Returns the property associated to name in the graph properties pool.
The returned property is referenced by its base class tlp.PropertyInterface meaning getting and setting values
can only be done via the use of strings. To get the property correctly typed, use the methods described above.
If the property does not exist it returns None.

Applies an algorithm plugin, identified by its name.
Algorithm plugins are objects implementing the tlp::Algorithm interface
in C++ or the tlp.Algorithm interface in Python.
Parameters can be transmit to the algorithm using a tlp.DataSet.
To determine a plugin’s parameters, you can either:

Computes a boolean property on the current graph
using an external named boolean algorithm (plugin).
Boolean algorithm plugins are objects
implementing the tlp::BooleanAlgorithm interface in C++ or
the tlp.BooleanAlgorithm interface in Python.
The list of currently loaded boolean algorithm plugins can be
retrieved through the tlp.getBooleanAlgorithmPluginsList() function.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a color property on the current graph
using an external named color algorithm (plugin).
Color algorithm plugins are objects
implementing the tlp::ColorAlgorithm interface in C++ or
the tlp.ColorAlgorithm interface in Python.
The list of currently loaded color algorithm plugins can be
retrieved through the tlp.getColorAlgorithmPluginsList() function.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a double property on the current graph
using an external named double algorithm (plugin).
Double algorithm plugins are objects
implementing the tlp::DoubleAlgorithm interface in C++ or
the tlp.DoubleAlgorithm interface in Python.
The list of currently loaded double algorithm plugins can be
retrieved through the tlp.getDoubleAlgorithmPluginsList() function.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes an integer property on the current graph
using an external named integer algorithm (plugin).
Integer algorithm plugins are objects
implementing the tlp::IntegerAlgorithm interface in C++ or
the tlp.IntegerAlgorithm interface in Python.
The list of currently loaded integer algorithm plugins can be
retrieved through the tlp.getIntegerAlgorithmPluginsList() function.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a layout property on the current graph
using an external named layout algorithm (plugin).
Layout algorithm plugins are objects
implementing the tlp::LayoutAlgorithm interface in C++ or
the tlp.LayoutAlgorithm interface in Python.
The list of currently loaded layout algorithm plugins can be
retrieved through the tlp.getLayoutAlgorithmPluginsList() function.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a size property on the current graph
using an external named size algorithm (plugin).
Size algorithm plugins are objects
implementing the tlp::SizeAlgorithm interface in C++ or
the tlp.SizeAlgorithm interface in Python.
The list of currently loaded size algorithm plugins can be
retrieved through the tlp.getSizeAlgorithmPluginsList() function.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a string property on the current graph
using an external named string algorithm (plugin).
String algorithm plugins are objects
implementing the tlp::StringAlgorithm interface in C++ or
the tlp.StringAlgorithm interface in Python.
The list of currently loaded string algorithm plugins can be
retrieved through the tlp.getStringAlgorithmPluginsList() function.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a boolean property on the current graph
using an external named boolean algorithm (plugin).
Boolean algorithm plugins are objects
implementing the tlp::BooleanAlgorithm interface in C++ or
the tlp.BooleanAlgorithm interface in Python.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a color property on the current graph
using an external named color algorithm (plugin).
Color algorithm plugins are objects
implementing the tlp::ColorAlgorithm interface in C++ or
the tlp.ColorAlgorithm interface in Python.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a double property on the current graph
using an external named double algorithm (plugin).
Double algorithm plugins are objects
implementing the tlp::DoubleAlgorithm interface in C++ or
the tlp.DoubleAlgorithm interface in Python.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes an integer property on the current graph
using an external named integer algorithm (plugin).
Integer algorithm plugins are objects
implementing the tlp::IntegerAlgorithm interface in C++ or
the tlp.IntegerAlgorithm interface in Python.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a layout property on the current graph
using an external named layout algorithm (plugin).
Layout algorithm plugins are objects
implementing the tlp::LayoutAlgorithm interface in C++ or
the tlp.LayoutAlgorithm interface in Python.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a size property on the current graph
using an external named size algorithm (plugin).
Size algorithm plugins are objects
implementing the tlp::SizeAlgorithm interface in C++ or
the tlp.SizeAlgorithm interface in Python.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Computes a string property on the current graph
using an external named string algorithm (plugin).
String algorithm plugins are objects
implementing the tlp::StringAlgorithm interface in C++ or
the tlp.StringAlgorithm interface in Python.
The computed values will be stored in result.
Parameters can be transmit to the algorithm
using a tlp.DataSet . In some cases, algorithms
can use this tlp.DataSet in order to return some external information
(not stored in result).
To determine a plugin’s parameters, you can either:

Marks the state of the current root graph in the hierarchy.
The next updates will be recorded in order to be undone at the
next call of the tlp.Graph.pop() method. Be careful that all
the updates are undone except those who affect the ordering of edges.

Parameters:

unpopAllowed (boolean) – If set to False, the next updates could not be replayed after undone. If some previously undonevupdates exist they could no longer be replayed.

Closes a subgraph into a metanode and returns it. Edges from nodes
in the subgraph to nodes outside the subgraph are replaced with
edges from the metanode to the nodes outside the subgraph.

The provided subgraph can not be a descendant of the current graph in the graph hierarchy.
When creating a metanode, all nodes that are closed in it are first deleted
from the graph. These nodes are also deleted in the subgraphs of the graph and
in all descendant subgraphs. So if the provided subgraph is a descendant of
the graph, all its nodes and edges will be deleted and the meta-node will
point to an empty subgraph.

This class represents a vector with 3 floating point components.
It can be instantiated as illustrated in the code below:

# Initializes a Vec3f with all components set to 0.0v=tlp.Vec3f()# Initializes a Vec3f with all components set to 1.0v2=tlp.Vec3f(1.0)# Initializes a Vec3f by specifying the value of each componentv3=tlp.Vec3f(1.0,2.0,3.0)# Initializes a Vec3f by copyv4=tlp.Vec3f(v3)

Numerous mathematical operations are available to work with vectors. The sample code below illustrates them:

# Instantiate two vectorsv=tlp.Vec3f(4.5,1.0,3.0)v2=tlp.Vec3f(1.5,2.0,6.0)# Add two vectors, operator += is also availablev3=v+v2# Add a value to all components of a vector, operator += is also availablev4=v+2.0# Subtract two vectors, operator -= is also availablev5=v-v2# Subtract a value to all components of a vector, operator -= is also availablev6=v-3.0# Multiply two vectors (not vector product), operator *= is also availablev7=v*v2# Multiply each component of a vector by a value, operator *= is also availablev8=v*2.0# Divide two vectors, operator /= is also availablev9=v/v2# Divide each component of a vector by a value, operator /= is also availablev10=v/2.0# Perform a vector product, operator ^= is also availablev11=v^v2

Each component of the vector can be read / written through the [] operator:

This class represents the 3D bounding box of an object.
It is defined by two 3d points, the first one being the lowest point (bottom-left corner),
the second being the highest (top-right corner).

A bounding box can be instantiated and manipulated the following ways:

# Initialize a non-valid bounding box.# The minimum is (1, 1, 1) and the maximum is (-1, -1, -1).bb=tlp.BoundingBox()# Initialize a bounding box by specifying the lowest and highest point.# The validity of the bounding box is checked in debug mode (an assertion is raised if it is not valid). bb2=tlp.BoundingBox(tlp.Vec3f(0,0,0),tlp.Vec3f(10,10,10))# Reading / writing the bounding box components can be done through the [] operatormin=bb2[0]max=bb2[1]

This class represents a color scale to perform color mapping.
The color scale can be either gradient (default) or predefined colors steps.
If the color scale is a gradient, returned colors are interpolated in function of the position.
If the color scale isn’t a gradient returned colors are the predefined colors steps.

The sample code below illustrates how to create and manipulate a color scale:

# Creating an empty color scale (default constructor creates a heatmap from blue to red).colorScale=tlp.ColorScale([])# Color scale initialization : from blue to red with gradient.colorScale.setColorAtPos(0.0,tlp.Color(0,0,255))colorScale.setColorAtPos(1.0,tlp.Color(255,0,0))# The following syntax could also be used# colors = [tlp.Color(0,0,255), tlp.Color(255,0,0)]# colorScale.setColorScale(colors)# or# colorScale = tlp.ColorScale(colors)# Get the color for the position 0.5, i.e. Color(127,0,127).color=colorScale.getColorAtPos(0.5);# Reinitialize the color scale : from blue to red without gradient.newColors=[]newColors.append(tlp.Color(0,0,255))newColors.append(tlp.Color(255,0,0))colorScale.setColorScale(newColors,False)# Get the color for the position 0.3, i.e. Color(0,0,255).color=colorScale.getColorAtPos(0.3)# Get the color for the position 0.7, i.e. Color(255,0,0).color=colorScale.getColorAtPos(0.7)

If you try to store an unsupported data type, an exception will be thrown.
Each value stored in a data set is associated to a string key. Reading / Writing a value in
a data set is done through the [] operator as illustrated below:

This class is the base one for representing an event in Tulip.
Events are objects sent by objects whose classes derives from the tlp.Observable one.
An event is characterized by its type. The base tlp.Event class only carries information as to the type of event, nothing specific :

tlp.Event.TLP_MODIFICATION : sent to all observers/listeners. That type of event is first sent to observers then to listeners.

tlp.Event.TLP_INFORMATION : sent only to listeners.

tlp.Event.TLP_INVALID : never sent, used internally for delaying events.

Implement a class derived from tlp.Event to add custom events.
Here is a sample code below:

classMyEvent(tlp.Event):# sender must be an instance deriving from tlp.Observabledef__init__(self,sender,data):tlp.Event.__init__(self,sender,tlp.Event.TLP_MODIFICATION)self.data=datadefgetData(self):returnself.data

tlp.GraphEvent.TLP_ADD_NODE : a node has been added in the graph (use tlp.GraphEvent.getNode() to get the concerned node)

tlp.GraphEvent.TLP_DEL_NODE : a node has been deleted in the graph (use tlp.GraphEvent.getNode() to get the concerned node)

tlp.GraphEvent.TLP_ADD_EDGE : an edge has been added in the graph (use tlp.GraphEvent.getEdge() to get the concerned edge)

tlp.GraphEvent.TLP_DEL_EDGE : an edge has been deleted in the graph (use tlp.GraphEvent.getEdge() to get the concerned edge)

tlp.GraphEvent.TLP_REVERSE_EDGE : the direction of an edge has been reversed in the graph (use tlp.GraphEvent.getEdge() to get the concerned edge)

tlp.GraphEvent.TLP_BEFORE_SET_ENDS : the extremities of an edge is about to be modified (use tlp.GraphEvent.getEdge() to get the concerned edge)

tlp.GraphEvent.TLP_AFTER_SET_ENDS : the extremities of an edge have been modified (use tlp.GraphEvent.getEdge() to get the concerned edge)

tlp.GraphEvent.TLP_ADD_NODES : several nodes have been added in the graph (use tlp.GraphEvent.getNodes() to get the list of concerned nodes)

tlp.GraphEvent.TLP_ADD_EDGES : several edges have been added in the graph (use tlp.GraphEvent.getEdges() to get the list of concerned edges)

tlp.GraphEvent.TLP_BEFORE_ADD_DESCENDANTGRAPH : a descendant graph (i.e. not necessarily a direct sub-graph) is about to be added in the sub-graphs hierarchy. Use tlp.GraphEvent.getSubGraph() to get it.

tlp.GraphEvent.TLP_AFTER_ADD_DESCENDANTGRAPH : a descendant graph (i.e. not necessarily a direct sub-graph) has been added in the sub-graphs hierarchy. Use tlp.GraphEvent.getSubGraph() to get it.

tlp.GraphEvent.TLP_BEFORE_DEL_DESCENDANTGRAPH : a descendant graph (i.e. not necessarily a direct sub-graph) is about to be removed in the sub-graphs hierarchy. Use tlp.GraphEvent.getSubGraph() to get it.

tlp.GraphEvent.TLP_AFTER_DEL_DESCENDANTGRAPH : a descendant graph (i.e. not necessarily a direct sub-graph) has been removed in the sub-graphs hierarchy. Use tlp.GraphEvent.getSubGraph() to get it.

tlp.GraphEvent.TLP_BEFORE_ADD_LOCAL_PROPERTY : a local property is about to be added in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_ADD_LOCAL_PROPERTY : a local property has been added in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_BEFORE_DEL_LOCAL_PROPERTY : a local property is about to be deleted in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_AFTER_DEL_LOCAL_PROPERTY : a local property has been deleted in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_BEFORE_ADD_INHERITED_PROPERTY : an inherited property (not attached to the graph itself but one of its parent) is about to be added in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_ADD_INHERITED_PROPERTY : an inherited property (not attached to the graph itself but one of its parent) has been added in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_BEFORE_DEL_INHERITED_PROPERTY : an inherited property (not attached to the graph itself but one of its parent) is about to be deleted in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_AFTER_DEL_INHERITED_PROPERTY : an inherited property (not attached to the graph itself but one of its parent) has been deleted in the graph. Use tlp.GraphEvent.getPropertyName() to get the name of the concerned property.

tlp.GraphEvent.TLP_BEFORE_SET_ATTRIBUTE : an attribute of the graph is about to be set/modified. Use tlp.GraphEvent.getAttributeName() to get the name of the concerned attribute.

tlp.GraphEvent.TLP_AFTER_SET_ATTRIBUTE : an attribute of the graph has been set/modified. Use tlp.GraphEvent.getAttributeName() to get the name of the concerned attribute.

Each class that wishes to send or receive notifications needs to inherit from tlp.Observable.

Tulip has two separate mechanisms of observation : Observers and Listeners.
These two mechanisms work through the same class, the difference lies in the way an Observer or Listener is attached to
the object whose events it will receive.

The Listener is closer to the original pattern, where events are sent directly to the recipient.
The Observer is a twist for performance purposes, it can receive the events in a delayed fashion, and cannot know
if the event was just sent or was delayed.

The purpose of this twist is to allow algorithms that perform a high number of modifications (e.g. creating a grid to route edges,
creating multiple subgraphs with metrics or layouts) to run smoothly without overcrowding the event queue.
As events are sent for every graph modification (e.g. adding a node, deleting a node, setting a value on a node), the
sheer quantity of events sent by these algortithms would cause a big performance hit.

The only exception to this mechanism is the tlp.Event.TLP_DELETE kind of event, that is never held back.
Think of it as an unmaskable POSIX signal; whatever the connection to the object and the state of holdObserver, this event will get through.
This is used to prevent crashes in the case where and object is listened or observed and is deleted, as it is likely the recipient
keeps a pointer to the now deleted object.

Holds back all events until tlp.Observable.unholObservers() is called.
Listeners are not affected by this function.
Once this function is called, all events heading to an Observer will be held, except tlp.Event.TLP_DELETE events.
The events are stored in a queue, and will be sent once tlp.Observable.unholObservers() is called.
It is possible to nest calls to tlp.Observable.holObservers() and tlp.Observable.unholObservers(),
and in this case the events will only be sent when there have been as many calls to tlp.Observable.unholObservers() as to tlp.Observable.holObservers().
It is possible to check whether the events are being help by checking the tlp.Observable.observersHoldCounter() function.

This function is called when events are sent to the Listeners, and Listeners only.
Is it passed a reference to the event that just happened. Implement that method
to catch events with custom types (like for instance tlp.GraphEvent or tlp.PropertyEvent)

Parameters:

event (tlp.Event or types deriving from it) – The event that was sent.

This function is called when events are sent to Observers, and Observers only.

It is passed a list of all the events that happened since the last call.
If events were on hold, this vector can be pretty large, and if events were not on hold it is likely it only contains a single element.
It is important to note that custom events can not be catched with that method. Only instances
of base tlp.Event type are stored in the list.
Moreover when unholding events through a call to tlp.Observable.unholdObservers(), if several
events were sent from the same object, only one instance of tlp.Event will be stored in the list
for that sender.

Clears all edges registered values, and sets a new edge default value
in converting the given string representation of a value.
Returns True if the given string representation has been successfully converted to a value, False otherwise.

Clears all nodes registered values, and sets a new node default value
in converting the given string representation of a value.
Returns True if the given string representation has been successfully converted to a value, False otherwise.

Performs an uniform quantification on nodes and edges based on the values stored in that double property.
An uniform quantification tries to separate the nodes and edges in n classes of equivalent size according to theirs values in increasing order.

Parameters:

n (integer) – the number of desired classes

Warning

All previous values on nodes and edges will be erased and replaced by the id of the class they belong to.

Performs an uniform quantification on nodes based on the values stored in that double property.
An uniform quantification tries to separate the nodes in n classes of equivalent size according to theirs values in increasing order.

Parameters:

n (integer) – the number of desired classes

Warning

All previous values on nodes will be erased and replaced by the id of the class they belong to.

Performs an uniform quantification on edges based on the values stored in that double property.
An uniform quantification tries to separate the edges in n classes of equivalent size according to theirs values in increasing order.

Parameters:

n (integer) – the number of desired classes

Warning

All previous values on edges will be erased and replaced by the id of the class they belong to.

Fixes embedding of the graph according to the layout,
ie. sort edges around nodes according to their neighbors/bends position in the layout.
Only works in 2D, the third coordinate is not taken into account.

Parameters:

subgraph (tlp.Graph) – a sub-graph can be given in parameter, in that case fixes embedding of that sub-graph

Throws :

an exception if the provided sub-graph is not a descendant of the graph attached to the property

computeEmbedding(node[, subgraph=None])

Fixes embedding of the node according to the layout,
ie. sort edges around the node according to their neighbors/bends position in the layout.
Only works in 2D, the third coordinate is not taken into account.

Parameters:

subgraph (tlp.Graph) – a sub-graph can be given in parameter, in that case fixes embedding of the node in that sub-graph

Throws :

an exception if the node does not belong to the graph attached to the property or if the provided sub-graph is not a descendant of the graph attached to the property

This abstract class describes a general algorithm plugin.
Basic functionality consists in checking the algorithm can run on the current Graph
(e.g. is the graph simple ?) then running the algorithm.
The algorithm can and should report progress and which task it is performing
if it is decomposed in multiple phases (e.g. layouting the graph, coloring it, ...).

This method is called before applying the algorithm on the input graph.
You can perform some precondition checks here. Derived classes can reimplement it.
Must return a tuple whose first member indicates if the algorithm can be applied
and the second one can be used to provide an error message

This method is the entry point of the algorithm when it is called.
Derived classes must implement it. It is a good practice to report progress through the PluginProgress.
The PluginProgress should also be used to report errors, if any. A boolean must also be returned
to indicate if the algorithm was successful.

Makes the graph acyclic, by reversing edge direction (feedback arc set problem).
If there is self loops, a new node is added with two edges that points to it.
Returns a tuple containing whose first member is a list of reversed edges and second member is a list
of transformed self loops.

Performs a simple test and returns a tuple with 3 elements. The first element is a boolean indicating the
result of the test. The second element is a list of found parallel edges. The third element is a list of
found self loops.