Welcome to graph-tool’s documentation!#
graph_tool module provides a
Graph class and
several algorithms that operate on it. The internals of this class, and of most
algorithms, are written in C++ for performance, using template metaprogramming for code
specialization, and the Boost Graph Library.
graph-tool can be orders of magnitude faster than Python-only alternatives, and
therefore it is specially suited for large-scale network analysis.
Besides superior performance,
graph-tool contains the following set of
functionalities which are currently not available in most other comparable
Comprehensive framework for inferential community detection, build upon statistically principled approaches that avoid overfitting and are interpretable. (See here as well as [descriptive-vs-inferential] for why you should avoid off-the-shelf methods available in other software packages.)
Support for OpenMP shared memory parallelism for several algorithms.
Filtered graphs, i.e. graphs where nodes and edges are temporarily masked. These are first class citizens in the library, and are accepted by every function. Due to the use C++ template metaprogramming, this functionality comes at no performance cost when filtering is not being used.
Efficient and fully documented binary format for network files.
Support for writing custom C++ extensions.
Detailed installation instructions for various platforms are available here.
The easiest option is to use conda:
conda create --name gt -c conda-forge graph-tool conda activate gt
Asking questions and reporting bugs#
If you have questions about using
graph-tool, you are welcome to visit the
If you encounter a problem, open an issue in the git repository.
Please don’t forget to check if your question has been asked before, or if a similar issue is open. When asking questions or reporting problems, it is important to include:
Your operating system.
A minimal working example that shows the problem.
Item 3 above is very important! If you provide us only the part of the code that you believe causes the problem, then it is not possible to understand the context that may have contributed to it.
How to use the documentation#
Documentation is available in two forms: docstrings provided with the code, and the full documentation available in the graph-tool homepage.
We recommend exploring the docstrings using IPython, an advanced Python shell with TAB-completion and introspection capabilities.
The docstring examples assume that
graph_tool.all has been imported as
>>> import graph_tool.all as gt
Code snippets are indicated by three greater-than signs:
>>> x = x + 1
Use the built-in
help function to view a function’s docstring:
- Quick start guide
- Creating graphs
- Manipulating graphs
- Example analysis: an online social network
- Property maps
- Graph I/O
- Graph filtering
- Advanced iteration
- Cookbook guides
- Inferring modular network structure
- Animations with graph-tool
- Integration with matplotlib
- Writing extensions in C++