Analyzing Complex Networks with Python
Project description
netsci
Analyzing Complex Networks with Python
Author | Version | Demo |
---|---|---|
Gialdetti |
netsci
is a python package for efficient statistical analysis of spatially-embedded networks. In addition, it offers several algorithms and implementations (CPU and GPU-based) 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.
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)]])
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)
Using GPU for the motif counting is easy
from netsci.models.random import erdos_renyi
A_er = erdos_renyi(n=1000, p=0.01, random_state=71070) # Create an Erdős–Rényi network
f_er = nsm.motifs(A_er, algorithm='gpu') # Count motifs using a GPU
print(f_er)
# [156453141 9481653 37283 95997 47667 48287 1001 843
# 769 334 2 9 5 9 0 0]
Installation
Install latest release version via pip
$ pip install netsci
Install latest development version
via pip
$ pip install git+https://github.com/gialdetti/netsci.git
or in development mode
$ git clone https://github.com/gialdetti/netsci.git
$ cd netsci
$ pip install -e .
Testing
After installation, you can launch the test suite:
$ pytest
Help and Support
Examples
Theme | MyBinder | Colab |
---|---|---|
Basic network motifs demo | ||
Connectomics dataset, and 3-neuron motif embedding |
Communication
Please send any questions you might have about the code and/or the algorithm to eyal.gal@mail.huji.ac.il.
Citation
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file netsci-0.0.3.tar.gz
.
File metadata
- Download URL: netsci-0.0.3.tar.gz
- Upload date:
- Size: 8.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac4f99b587036357e95d43ded6aa66cab3d2deb506fa4ae6a9ce4f497a5a86ba |
|
MD5 | 15d0e63fc56200813fa65ecc9feb7b0a |
|
BLAKE2b-256 | 3840d337ce878552bbaacbaa5aaa2ce6e007796c2a0d98fdcd6a7b60b7f0ac48 |
File details
Details for the file netsci-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: netsci-0.0.3-py3-none-any.whl
- Upload date:
- Size: 464.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fec1c6539e31c3143ff019e65bfbfdfec2cec32e7912501a69f6ae159dbe1db |
|
MD5 | 481169a7ee91e14c1131ea03299cff26 |
|
BLAKE2b-256 | 209aa04a125ce55574b4d7cc8c8ba5ff77b1ce58733ea5e0a6ab3f2fa6dbc217 |