Package: networkit
NetworKitis an open-source tool suite for high-performance
network analysis. Its aim is to provide tools for the analysis of large
networks in the size range from thousands to billions of edges. For this
purpose, it implements efficient graph algorithms, many of them parallel to
utilize multicore architectures. These are meant to compute standard measures
of network analysis. NetworKit is focused on scalability and comprehensiveness.
NetworKit is also a testbed for algorithm engineering and
contains novel algorithms from recently published research (see list of publications below).NetworKit is a Python module. High-performance algorithms are written in C++ and exposed to Python
via the Cython toolchain. Python in turn gives us the ability to work interactively and a
rich environment of tools for data analysis and scientific computing.
Furthermore, NetworKit's core can be built and used as a native library if needed.RequirementsYou will need the following software to install NetworKit as a python
package:A modern C++ compiler, e.g.:g++(>= 8.1),clang++(>= 6.0) or MSVC (>= 14.20)OpenMP for parallelism (usually ships with the compiler)Python3 (3.8 or higher is supported)Development libraries for Python3. The package name depends on your distribution. Examples:Debian/Ubuntu:apt-get install python3-devRHEL/CentOS:dnf install python3-develWindows: Use the official release installer fromwww.python.orgPipCMakeversion 3.6 or higher (Advised to use system packages if available. Alternative:pip3 install cmake)Build system:MakeorNinjaCython version 0.29 or higher (e.g.,pip3 install cython)InstallIn order to use NetworKit, you can either install it via package managers
or build the Python module from source.Install via package managerWhile the most recent version is in general available for all package managers, the number of older downloadable versions differ.pippip3 install [--user] networkitconda (channel conda-forge)conda config --add channels conda-forge
conda install networkit [-c conda-forge]brewbrew install networkitspackspack install py-networkitMore system-specific information on how to install NetworKit on Linux, macOS (both Intel and M1) and Windows-systems can be foundhere.Building the Python module from sourcegit clone https://github.com/networkit/networkit networkit
cd networkit
python3 setup.py build_ext [-jX]
pip3 install -e .The script will callcmakeandninja(makeas fallback) to compile
NetworKit as a library, build the extensions and copy it to the top folder. By
default, NetworKit will be built with the amount of available cores in
optimized mode. It is possible the add the option-jNthe number of threads
used for compilation.Usage exampleTo get an overview and learn about NetworKit's different functions/classes, have a look at our interactivenotebooks-section, especially theNetworkit UserGuide. Note: To view and edit the computed output from the notebooks, it is recommended to useJupyter Notebook. This requires the prior installation of NetworKit. You should really check that out before start working on your network analysis.We also provide a Binder-instance of our notebooks. To access this service, you can either click on the badge at the top or follow thislink. Disclaimer: Due to rebuilds of the underlying image, it can takes some time until your Binder instance is ready for usage.If you only want to see in short how NetworKit is used - the following example provides a climpse at that. Here we generate a random hyperbolic graph with 100k nodes and compute its communities with the PLM method:>>> import networkit as nk
>>> g = nk.generators.HyperbolicGenerator(1e5).generate()
>>> communities = nk.community.detectCommunities(g, inspect=True)
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
-------------------  -----------Install the C++ Core onlyIn case you only want to work with NetworKit's C++ core, you can either install it via package
managers or build it from source.Install C++ core via package managerconda (channel conda-forge)conda config --add channels conda-forge
conda install libnetworkit [-c conda-forge]brewbrew install libnetworkitspackspack install libnetworkitBuilding the C++ core from sourceWe recommendCMakeand your preferred build system for building the C++ part of NetworKit.The following description shows how to useCMakein order to build the C++ Core only:First you have to create and change to a build directory: (in this case namedbuild)mkdir build
cd buildThen callCMaketo generate files for themakebuild system, specifying the directory of the rootCMakeLists.txtfile (e.g.,..). After thismakeis called to start the build process:cmake ..
make -jXTo speed up the compilation with make a multi-core machine, you can append-jXwhere X denotes the number of threads to compile with.Use NetworKit as a libraryThis paragraph explains how to use the NetworKit core C++ library in case it has been built from source.
For how to use it when installed via package managers, best refer to the official documentation (brew,conda,spack).In order to use the previous compiled networkit library, you need to have it installed, and link
it while compiling your project. Use these instructions to compile and install NetworKit in/usr/local:cmake ..
make -jX installOnce NetworKit has been installed, you can use include directives in your
C++-application as follows:#include <networkit/graph/Graph.hpp>You can compile your source as follows:g++ my_file.cpp -lnetworkitUnit testsBuilding and running NetworKit unit tests is not mandatory.
However, as a developer you might want to write and run unit tests for your
code, or if you experience any issues with NetworKit, you might want to check
if NetworKit runs properly.
The unit tests can only be run from a clone or copy of the repository and not
from a pip installation. In order to run the unit tests, you need to compile
them first. This is done by setting theCMakeNETWORKI_BUILD_TESTSflag toON:cmake -DNETWORKIT_BUILD_TESTS=ON ..Unit tests are implemented using GTest macros such asTEST_F(CentralityGTest, testBetweennessCentrality).
Single tests can be executed with:./networkit_tests --gtest_filter=CentralityGTest.testBetweennessCentralityAdditionally, one can specify the level of the logs outputs by adding--loglevel <log_level>;
supported log levels are:TRACE,DEBUG,INFO,WARN,ERROR, andFATAL.Compiling with address/leak sanitizersSanitizers are great tools to debug your code. NetworKit provides additionalCmakeflags
to enable address, leak, and undefined behavior sanitizers.
To compile your code with sanitizers, set theCMakeNETWORKIT_WITH_SANITIZERSto eitheraddressorleak:cmake -DNETWORKIT_WITH_SANITIZERS=leak ..By setting this flag toaddress, your code will be compiled with theaddressand theundefinedsanitizers.
Setting it toleakalso adds theleaksanitizer.DocumentationThe most recent version of thedocumentation can be found online.ContactFor questions regarding NetworKit, have a look at ourissues-sectionand see if there is already an open discussion. If not feel free to open a new issue.
To stay updated about this project, subscribe to ourmailing list.ContributionsWe encourage contributions to the NetworKit source code. See thedevelopment guidefor instructions. For support please contact themailing list.CreditsList of contributors can be found on theNetworKit website credits page.External CodeThe program source includes:theTLXlibrarytheTTMathbignum libraryLicenseThe source code of this program is released under theMIT License.  We ask you to cite us if you use this code in your project (c.f. the publications section below and especially thetechnical report). Feedback is also welcome.PublicationsTheNetworKit publications pagelists the publications on NetworKit as a toolkit, on algorithms available
in NetworKit, and simply using NetworKit. We ask you to cite the appropriate ones if you found NetworKit useful for your own research.