Skip to main content

Large graphs analysis and drawing

Project description

Module description

Graphs play an important role in many research areas, such as biology, microelectronics, social sciences, data mining, and computer science. Tulip (http://tulip.labri.fr) [1] is an Information Visualization framework dedicated to the analysis and visualization of such relational data. Written in C++ the framework enables the development of algorithms, visual encodings, interaction techniques, data models, and domain-specific visualizations.

The Tulip core library is available to the Python community through the Tulip-Python bindings [2]. The bindings have been developed using the SIP tool [3] from Riverbank Computed Limited, allowing to easily create quality Python bindings for any C/C++ library. The main features provided by the bindings are the following ones:

  • Creation and manipulation of graphs : Tulip provides an efficient graph data structure for storing large and complex networks. It is also one of the few that offer the possibility to efficiently define and navigate graph hierarchies or cluster trees (nested sub-graphs).

  • Storage of data on graph elements : Tulip allows to associate different kind of serializable data (boolean, integer, float, string, …) and visual attributes (layout, color, size, …) to graph elements. All these data can be easily accessed from the Tulip graph data structure facilitating the development of algorithms.

  • Application of algorithms of different types on graph : Tulip has been designed to be easily extensible and provides a variety of graph algorithms (layout, metric, clustering, …) implemented as C++ plugins. All these algorithms can be called from Python. As Tulip is dedicated to graph visualization, it is provided with numerous state of the art graph layout algorithms but also a bridge to the Open Graph Drawing Framework (http://www.ogdf.net) [4]

Release notes

Some informations regarding the Tulip-Python releases pushed on the Python Packaging Index:

  • 4.8.0.post1 :

    • Fix crash on MacOS when calling OGDF layout algorithms

    • minor fixes

  • 4.8.0 : Initial release based on Tulip 4.8

Example

The following script imports the dependency graph from the locally installed pip packages, draws it using a force directed layout algorithm and serializes the resulting graph to a file through the TLP graph format. The imported graph can then be visualized through the Tulip software or the use of the dedicated tulipgui module, enabling to create the OpenGL visualizations available in Tulip from Python.

import pip
import re

from tulip import *

# create a new empty graph
graph = tlp.newGraph()

# dictionnary mapping package name to graph node
packageNode = {}

# iterate over locally installed pip packages
for d in pip.get_installed_distributions():
  # add a node associated to the package
  n = graph.addNode()
  packageNode[d.key] = n
  # set node label for use with Tulip visualizations components
  graph['viewLabel'][n] = d.key

# iterate over locally installed pip packages
for d in pip.get_installed_distributions():
  # iterate over package requirements
  for r in d.requires():
    # process requirement name to get its pip package name :
    # switch to lower case and remove version infos if any
    s = str(r).lower()
    match = re.search('|'.join(map(re.escape, '<=>')), s)
    if match:
      s = s[:match.start()]
    # add an edge between the pip package and its dependency in the graph
    graph.addEdge(packageNode[d.key], packageNode[s])

# apply a force directed layout algorithm on the graph then a connected component packing algorithm.
# algorithms are called with their default parameters.
# resulting layout will be stored in the defaut graph layout property named 'viewLayout'
graph.applyLayoutAlgorithm('Fast Multipole Multilevel Embedder (OGDF)')
graph.applyLayoutAlgorithm('Connected Component Packing (Polyomino)')

# serializes the graph to a file using the TLP graph format,
# that file can then be opened with the Tulip software for visualization purposes.
tlp.saveGraph(graph, 'pip_deps.tlp')

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

tulip_python-4.8.0.post1-cp35-none-win_amd64.whl (12.5 MB view hashes)

Uploaded CPython 3.5 Windows x86-64

tulip_python-4.8.0.post1-cp35-none-win32.whl (12.0 MB view hashes)

Uploaded CPython 3.5 Windows x86

tulip_python-4.8.0.post1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (15.5 MB view hashes)

Uploaded CPython 3.5m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

tulip_python-4.8.0.post1-cp34-none-win_amd64.whl (12.5 MB view hashes)

Uploaded CPython 3.4 Windows x86-64

tulip_python-4.8.0.post1-cp34-none-win32.whl (12.0 MB view hashes)

Uploaded CPython 3.4 Windows x86

tulip_python-4.8.0.post1-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (15.5 MB view hashes)

Uploaded CPython 3.4m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

tulip_python-4.8.0.post1-cp33-none-win_amd64.whl (12.5 MB view hashes)

Uploaded CPython 3.3 Windows x86-64

tulip_python-4.8.0.post1-cp33-none-win32.whl (12.0 MB view hashes)

Uploaded CPython 3.3 Windows x86

tulip_python-4.8.0.post1-cp33-cp33m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (15.5 MB view hashes)

Uploaded CPython 3.3m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

tulip_python-4.8.0.post1-cp27-none-win_amd64.whl (12.5 MB view hashes)

Uploaded CPython 2.7 Windows x86-64

tulip_python-4.8.0.post1-cp27-none-win32.whl (12.0 MB view hashes)

Uploaded CPython 2.7 Windows x86

tulip_python-4.8.0.post1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (15.5 MB view hashes)

Uploaded CPython 2.7 macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page