Skip to content

Python package implementing rewiring algorithms and summary metrics for binary and weighted networks

License

Notifications You must be signed in to change notification settings

rentzi/netRewireAnalyze

Repository files navigation

netRewireAnalyze: A package implementing rewiring models and summary metrics on binary and weighted networks

Left Schematic anatomical connections of the lateral geniculate nucleus (LGN) and primary visual cortex processing the visual input

Right Network representation of the anatomical connections with the numbers indicating the strengths of the connection

I wrote this package while working on a project on adaptive rewiring and learning that culminated in the following paper:
Rentzeperis, I., van Leeuwen, C. Adaptive rewiring evolves brain-like structure in weighted networks.Sci Rep 10, 6075 (2020).
You can freely use the code; please cite the paper if you do so.

This package contains modules that implement the following:

  1. Three rewiring models that result in small world networks, for both binary and weighted networks. These are:

Adjacency matrices after 4000 rewirings on an initially randomly connected network. The rewirings are based on the heat diffusion algorithm, the first two adjacency matrices have binary connections (either 0 or 1) and the latter two normally distributed weights. The final connectivity pattern can vary depending on the value of the rewiring rate parameter

  1. Summary metrics of the networks that are in the form of adjacency matrices. There are metrics for both binary and weighted undirected networks (symmetric adjacency matrices). The metrics are
  • Path length
  • Clustering coefficient
  • Small worldness
  • Modularity index
  • Assortativity
  • Rich club

Please note, that while writing this code my first prioritiy was to break it down in an understandable -to myself at least- way. Optimality thus took a back seat, but hopefully functions are not desperately slow.

Prerequisites

  • Python 3+
  • scipy
  • numpy
  • matplotlib

Installation

the package netRewireAnalyze is the folder that will be created once you clone this repository. It contains 4 modules: initializeRewireNetworks.py, assortativityRichClub.py, modularity.py and smallWorldMetrics.py. To run the functions of the package include the path with the package folder. For example

import sys
sys.path.append('the directory path')
import netRewireAnalyze

Getting Started

Each of the functions is commented and relatively easy to understand. It is highly recommendeded that you go through the 2 jupyter notebooks in the repository. They will walk you through the functions of the code. The two notebooks are:

  1. networkInitializationRewiringVisualization.ipynb gives examples on how to initialize networks (adjacency matrices), rewire them with the 3 different algorithms and visualize them
  2. networkMetrics.ipynb gives examples on how to get the different summary metrics of a network

Author

Ilias Rentzeperis

About

Python package implementing rewiring algorithms and summary metrics for binary and weighted networks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published