graph-tool
Convert from any graph formatto graph-tool Convert from graph-toolto any other format
graph-tool is a Python module for the manipulation and statistical analysis of graphs (networks), developed by Tiago P. Peixoto and released under the LGPLv3. Its distinguishing characteristic is implementation strategy: the core data structures and algorithms are written in C++ on top of the Boost Graph Library, using template metaprogramming and exposed to Python through Boost.Python. As a result it attains memory usage and runtime comparable to a pure C/C++ program while retaining a scripting interface, and many routines are parallelised with OpenMP for multi-core machines. It is mature software, having tracked network science for over fifteen years.
The data model is a directed or undirected graph carrying arbitrary property maps on vertices, edges, and the graph itself, with typed values (bool, int, double, string, vectors, Python objects). Filtered and reversed graphs are first-class views that work transparently across the API without copying. Beyond standard algorithms (centrality, shortest paths, maximum flow, minimum spanning trees, isomorphism, clustering, motifs), graph-tool's flagship capability is principled statistical inference of network structure: community detection via stochastic block models fitted with a minimum-description-length / Bayesian approach that resists the overfitting typical of modularity maximisation, plus network reconstruction and uncertainty quantification. Drawing is done through Cairo/GTK or Graphviz.
In the format-conversion landscape, graph-tool reads and writes four serialisations: its own compact binary gt format, GraphML, DOT, and GML. The gt binary and GraphML are the complete, lossless options because they preserve exact property types; DOT and GML round-trip topology but lose type information, so properties come back as strings (or doubles) and must be re-cast by hand. This makes graph-tool a useful hub for moving typed network data, and it interoperates with the broader Python ecosystem alongside NetworkX and igraph, though its native formats are less universal than those exchanged by Gephi or Cytoscape.
The chief practical limitation is installation. Because it links against Boost, CGAL, expat, and Cairo, graph-tool historically could not be installed by a simple pip command and is instead distributed as distribution packages, conda-forge builds, or Docker images; building from source is heavyweight. It also targets Linux and macOS rather than native Windows. These trade-offs are the cost of its performance and rigorous inference machinery, which remain its main draw over lighter pure-Python libraries.
Graph Formats(Input & Output)
Frequently Asked Questions
What graph file formats does graph-tool support?
See the list on this page — it shows every format graph-tool can read, write and display.
How do I import a graph into graph-tool?
Convert your file to a format graph-tool can read, then open it in graph-tool. Use GraphInOut to get a graph-tool-compatible file in seconds.
How do I convert a file so graph-tool can open it?
Use the convert links above — upload or paste your graph, pick a format graph-tool accepts and download the result, right in your browser.
