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, 2]_ 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 [3]. The bindings have been developed using the SIP tool [4] 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) [5]

Release notes

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

  • 5.0.0: based on Tulip 5.0.0 released on 27/06/2017

    • mainly a bugs and memory leaks fix release for the Python bindings that now benefit from the performance improvements recently integrated in the tulip-core C++ library

    • some new methods added in the API and some deprecated (see updated documentation)

    • new Tulip plugins have been added, notably import ones like BibTex, GraphML, npm, … (see updated plugins list in the documentation)

  • 4.10.0: based on Tulip 4.10.0 released on 08/12/2016

    • some new methods added and API improvements (see updated documentation)

    • add a new section in the documentation detailing the C++ plugins bundled with Tulip that can be called from Python

    • improvements for working with Tulip color scales (see updated documentation)

  • 4.9.0 : based on Tulip 4.9.0 released on 08/07/2016

    • add a mechanism to ease the creation of graph properties through type inference (see updated documentation)

    • simplify the declaration of file parameters for Tulip Python plugins (see updated documentation)

    • a few bugs fixes

  • 4.8.1 : based on Tulip 4.8.1 released on 16/02/2016

    • add new convenient methods for getting / setting multiple properties values of nodes and edges, trough the use of a dictionnary, in the tlp.Graph class (see updated documentation)

    • some bugs fixes

  • 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 tlp

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

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

def addPackageNode(package):
  if not package in packageNode:
    n = graph.addNode()
    packageNode[package] = n
    # set node label for use with Tulip visualizations components
    graph['viewLabel'][n] = package

# iterate over locally installed pip packages
for d in pip.get_installed_distributions():
  # add a node associated to the package
  addPackageNode(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 info if any
    s = str(r).lower()
    match = re.search('|'.join(map(re.escape, '<=>;!')), s)
    if match:
      s = s[:match.start()]
    # add dependency package node if it does not exist yet
    addPackageNode(s)
    # 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)')

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-5.0.0-cp36-cp36m-win_amd64.whl (24.3 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

tulip_python-5.0.0-cp36-cp36m-win32.whl (22.7 MB view hashes)

Uploaded CPython 3.6m Windows x86

tulip_python-5.0.0-cp36-cp36m-manylinux1_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.6m

tulip_python-5.0.0-cp36-cp36m-manylinux1_i686.whl (10.9 MB view hashes)

Uploaded CPython 3.6m

tulip_python-5.0.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (17.4 MB view hashes)

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

tulip_python-5.0.0-cp35-cp35m-win_amd64.whl (24.3 MB view hashes)

Uploaded CPython 3.5m Windows x86-64

tulip_python-5.0.0-cp35-cp35m-win32.whl (22.7 MB view hashes)

Uploaded CPython 3.5m Windows x86

tulip_python-5.0.0-cp35-cp35m-manylinux1_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.5m

tulip_python-5.0.0-cp35-cp35m-manylinux1_i686.whl (10.9 MB view hashes)

Uploaded CPython 3.5m

tulip_python-5.0.0-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 (17.4 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-5.0.0-cp34-cp34m-win_amd64.whl (24.3 MB view hashes)

Uploaded CPython 3.4m Windows x86-64

tulip_python-5.0.0-cp34-cp34m-win32.whl (22.7 MB view hashes)

Uploaded CPython 3.4m Windows x86

tulip_python-5.0.0-cp34-cp34m-manylinux1_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.4m

tulip_python-5.0.0-cp34-cp34m-manylinux1_i686.whl (10.9 MB view hashes)

Uploaded CPython 3.4m

tulip_python-5.0.0-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 (17.4 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-5.0.0-cp33-cp33m-win_amd64.whl (24.3 MB view hashes)

Uploaded CPython 3.3m Windows x86-64

tulip_python-5.0.0-cp33-cp33m-win32.whl (22.7 MB view hashes)

Uploaded CPython 3.3m Windows x86

tulip_python-5.0.0-cp33-cp33m-manylinux1_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.3m

tulip_python-5.0.0-cp33-cp33m-manylinux1_i686.whl (10.9 MB view hashes)

Uploaded CPython 3.3m

tulip_python-5.0.0-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 (17.4 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-5.0.0-cp27-cp27mu-manylinux1_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 2.7mu

tulip_python-5.0.0-cp27-cp27mu-manylinux1_i686.whl (10.9 MB view hashes)

Uploaded CPython 2.7mu

tulip_python-5.0.0-cp27-cp27m-win_amd64.whl (24.3 MB view hashes)

Uploaded CPython 2.7m Windows x86-64

tulip_python-5.0.0-cp27-cp27m-win32.whl (22.7 MB view hashes)

Uploaded CPython 2.7m Windows x86

tulip_python-5.0.0-cp27-cp27m-manylinux1_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 2.7m

tulip_python-5.0.0-cp27-cp27m-manylinux1_i686.whl (10.9 MB view hashes)

Uploaded CPython 2.7m

tulip_python-5.0.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (17.4 MB view hashes)

Uploaded CPython 2.7m 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