Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Analyzing Complex Networks with Python

Project description


Analyzing Complex Networks with Python

Author Version Demo
Gialdetti PyPI Binder

netsci is a python package for efficient statistical analysis of spatially-embedded networks. In addition, it offers efficient implementations of motif counting algorithms. For other models and metrics, we highly recommend using existing and richer tools. Noteworthy packages are the magnificent NetworkX, graph-tool or Brain Connectivity Toolbox.


Install and update using pip:

$ pip install netsci

A simple example

Analyzing a star network (of four nodes)

>>> import numpy as np
>>> import netsci.visualization as nsv
>>> A = np.array([[0,1,1,1], [0,0,0,0], [0,0,0,0], [0,0,0,0]])
>>> nsv.plot_directed_network(A, pos=[[0,0],[-1,1],[1,1],[0,-np.sqrt(2)]])

Alt text

>>> import netsci.metrics.motifs as nsm
>>> f = nsm.motifs(A, algorithm='brute-force')
>>> print(f)
[1 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0]
>>> nsv.bar_motifs(f)

Alt text


After installation, you can launch the test suite:

$ pytest

Help and Support


Theme MyBinder
Basic network motifs demo Binder
Connectomics dataset, and 3-neuron motif embedding Binder


Please send any questions you might have about the code and/or the algorithm to


If you use netsci in a scientific publication, please consider citing the following paper:

Gal, E., Perin, R., Markram, H., London, M., and Segev, I. (2019). Neuron Geometry Underlies a Universal Local Architecture in Neuronal Networks. BioRxiv 656058.

Bibtex entry:

@article {Gal2019
    author = {Gal, Eyal and Perin, Rodrigo and Markram, Henry and London, Michael and Segev, Idan},
    title = {Neuron Geometry Underlies a Universal Local Architecture in Neuronal Networks},
    year = {2019},
    doi = {10.1101/656058},
    journal = {bioRxiv}

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for netsci, version
Filename, size File type Python version Upload date Hashes
Filename, size netsci- (442.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size netsci- (429.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page