logograph-toolEfficient network analysis

What is graph-tool?

Graph-tool is an efficient Python module for manipulation and statistical analysis of graphs (a.k.a. networks). Contrary to most other Python modules with similar functionality, the core data structures and algorithms are implemented in C++, making extensive use of template metaprogramming, based heavily on the Boost Graph Library. This confers it a level of performance that is comparable (both in memory usage and computation time) to that of a pure C/C++ library.


Installation instructions | Changelog

conda create --name gt -c conda-forge graph-tool
conda activate gt
Conda installation (GNU/Linux|MacOS)
brew install graph-tool
Homebrew installation (MacOS)
add-apt-repository "deb [ arch=amd64 ] https://downloads.skewed.de/apt DISTRIBUTION main"
apt-key adv --keyserver keys.openpgp.org --recv-key 612DEFB798507F25
apt-get update
apt-get install python3-graph-tool
Debian/Ubuntu GNU/Linux installation
pikaur -S python-graph-tool
Arch GNU/Linux installation
emerge graph-tool
Gentoo GNU/Linux installation
docker pull tiagopeixoto/graph-tool
Docker installation (GNU/Linux|MacOS|Windows)

It is Fast!

Despite its nice, soft outer appearance of a regular Python module, the core algorithms and data structures of graph-tool are written in C++, with performance in mind. Most of the time, you can expect the algorithms to run just as fast as if graph-tool were a pure C/C++ library. See a performance comparison.

OpenMP Support

Many algorithms are implemented in parallel using OpenMP, which provides excellent performance on multi-core architectures, without degrading it on single-core machines.

Extensive Features

An extensive array of features is included, such as support for arbitrary vertex, edge or graph properties, efficient "on the fly" filtering of vertices and edges, powerful graph I/O using the GraphML, GML and dot file formats, graph pickling, graph statistics (degree/property histogram, vertex correlations, average shortest distance, etc.), centrality measures, standard topological algorithms (isomorphism, minimum spanning tree, connected components, dominator tree, maximum flow, etc.), generation of random graphs with arbitrary degrees and correlations, detection of modules and communities via statistical inference, and much more.

Powerful Visualization

Conveniently draw your graphs, using a variety of algorithms and output formats (including to the screen). Graph-tool has its own layout algorithms and versatile, interactive drawing routines based on cairo and GTK+, but it can also work as a very comfortable interface to the excellent graphviz package.

Fully Documented

Every single function in the module is documented in the docstrings and in the online documentation, which is full of examples.

  • PageRank
  • Stochastic Blockmodel Inference
  • Hierarchical Stochastic Blockmodel Inference
  • Maximum Flow
  • Generation of Random GraphsGeneration of Random Graphs
  • Graph Search
  • Graph Spectra
  • Subgraph IsomorphismSubgraph Isomorphism
  • K-Core Decomposition
  • Preferential Attachment