NetworKit is a toolbox for high-performance network analysis
Actively maintained. Last release 3 weeks ago, commits in 24 of the last 26 weeks. A safe choice.
NetworKit is a toolbox for high-performance network analysis
Actively maintained. Last release 3 weeks ago, commits in 24 of the last 26 weeks. A safe choice.
pip install networkit
High-performance tools for large-scale network analysis
Explore the docs »
Try Demo
·
Report Bug
·
Request Feature
NetworKit is an open-source toolkit for high-performance network analysis, designed to handle large networks ranging from thousands to billions of edges. Built with efficiency and scalability at its core, NetworKit implements parallel graph algorithms that leverage multicore architectures to compute standard measures of network analysis.
As both a production tool and a research testbed for algorithm engineering, NetworKit includes novel algorithms from recent publications alongside battle-tested implementations. The toolkit is available as a Python module with high-performance C++ algorithms exposed through Cython, combining Python's interactivity and rich ecosystem with C++'s computational efficiency.
For most users, NetworKit can be installed directly via package managers with no additional requirements other than Python 3.10+.
| Package Manager | Command |
|---|---|
| pip | pip install networkit |
| conda | conda install -c conda-forge networkit |
| brew | brew install networkit |
| spack | spack install py-networkit |
If you only need the C++ core without Python bindings:
| Package Manager | Command |
|---|---|
| conda | conda install -c conda-forge libnetworkit |
| brew | brew install libnetworkit |
| spack | spack install libnetworkit |
More platform-specific installation instructions can be found in our getting started guide.
If you are interested in the most recent build of NetworKit, you can use the nightly channel networkit-nightly on anaconda.org.
Published packages are based on pushes to the master-branch, and the channel keeps the five most recent ones.
| Package Manager | Command |
|---|---|
| pip | pip install --upgrade --extra-index-url https://pypi.anaconda.org/networkit-nightly/simple networkit-nightly |
Here's a quick example showing how to generate a random hyperbolic graph with 100k nodes and detect communities:
from networkit.generators import HyperbolicGenerator
from networkit.community import detectCommunities
# Generate a random hyperbolic graph
g = (
HyperbolicGenerator(1e5)
.generate()
)
# Detect communities
detectCommunities(g, inspect=True)
Output:
PLM(balanced,pc,turbo) detected communities in 0.14577102661132812 [s]
solution properties:
------------------- -----------
# communities 4536
min community size 1
max community size 2790
avg. community size 22.0459
modularity 0.987243
------------------- -----------
Compute PageRank to rank nodes by importance:
from networkit.centrality import PageRank
pr = (
PageRank(g)
.run()
)
top_nodes = pr.ranking()[:10]
Analyze graph structure with connected components:
from networkit.components import ConnectedComponents
cc = (
ConnectedComponents(g)
.run()
)
print(f"Components: {cc.numberOfComponents()}")
print(f"Largest: {max(cc.getComponentSizes().values())}")
For comprehensive examples and tutorials, explore our interactive notebooks, especially the NetworKit User Guide. You can try NetworKit directly in your browser using our Binder instance.
Building from source requires:
apt-get install python3-devdnf install python3-develgit clone https://github.com/networkit/networkit networkit
cd networkit
pip install cython numpy setuptools wheel
python setup.py build_ext [-jX]
pip install -e .
The -jX option specifies the number of threads for compilation (e.g., -j4 for 4 threads). If omitted, it uses all available CPU cores.
mkdir build && cd build
cmake ..
make -jX
sudo make install
After installation, include NetworKit headers:
#include <networkit/graph/Graph.hpp>
Compile your project:
g++ my_file.cpp -lnetworkit
To build and run tests:
cmake -DNETWORKIT_BUILD_TESTS=ON ..
make
./networkit_tests --gtest_filter=CentralityGTest.testBetweennessCentrality
For debugging with address/leak sanitizers:
cmake -DNETWORKIT_WITH_SANITIZERS=leak ..
The complete documentation is available online at networkit.github.io.
We welcome contributions to NetworKit! Whether you're fixing bugs, adding features, or improving documentation, your help makes NetworKit better for everyone.
For support, join our mailing list.
Distributed under the MIT License. We ask that you cite us if you use NetworKit in your research (see our technical report and publications page).
NetworKit has been used in numerous research projects. Visit our publications page for a complete list of papers about NetworKit, algorithms implemented in NetworKit, and research using NetworKit.
NetworKit is developed by a dedicated team of researchers and contributors. View the full list of contributors on our credits page.
Use instead of networkit: tools that do the same job, closest first.
Compare with networkx →Compare with scikit-network →Compare with rustworkx →Compare all 4 →
Python package for creating and manipulating graphs and networks
Commit activity
24/26 weeks with commits
Release cadence
3 releases in 12 months
Issues & PRs handled
76% closed in the past year
Contributor spread
12 authors in last 100 commits
OpenSSF Scorecard
5.4/10
Graph algorithms
A High-Performance Graph Library for Python
High performance graph data structures and algorithms (legacy package)