A small python package designed to calculate the small-world propensity of a weighted, undirected network. Translated from the MATLAB version featured in Muldoon et al.
Project description
Small World Propensity
This python package was adapted from the MATLAB package as first presented in Small-World Propensity and Weighted Brain Networks (2016) by Sarah Feldt Muldoon, Eric W. Bridgeford & Danielle S. Bassett. Their original MATLAB implementation can be found here.
Use
The small-world propensity package can be installed using pip
python -m pip install small-world-propensity
small_world_propensity
can be called in two ways: either with a single adjacency matrix, or with a list of adjacency matrices and a boolean list denoting whether each matrix is binary or not. In either case, small_world_propensity
will return a pandas
dataframe similar to the following:
Generation of regular and random matrices
Using the structural network of the cat cortex obtained from tract-tracing studies between 52 brain regions, we can visualize the process behind the calculation of the small-world propensity, $\phi$. The matrix is loaded using
cat = sio.loadmat('data/cat.mat')['CIJctx']
We can then ensure symmetry by calling
symm_cat = swp.make_symmetric(cat)
In order to get the regular version of the cat matrix, we first find the effective average radius:
r = swp.get_avg_rad_eff(symm_cat)
cat_reg = swp.regular_matrix_generator(symm_cat, r)
Finally we produce the randomized cat matrix:
cat_rand = swp.randomize_matrix(cat_symm)
The graphs visualized in a circular layout look as follows:
Comparison of $\phi$ in real networks
We can take the networks used in Muldoon et al and plot $\phi$, $\Delta_L$, $\Delta_C$, and $\delta$. Note that these networks are not the exact same as the ones used in Muldoon et al, and due to differences in how Numpy performs permutations, and the use of NetworkX and iGraph libraries, the results are not identical, but still match closely.
The adjacency matrices:
And the results:
To cite this work, please use:
@software{small-world-propensity,
author = {{Daniels, R. K.}},
title = {small-world-propensity},
year = 2023,
publisher = {Zenodo},
version = {v0.0.8},
doi = {10.5281/zenodo.10299681},
url = {https://github.com/rkdan/small-world-propensity}
}
Please also cite the authors of the original MATLAB implementation:
@article{Muldoon2016,
author = "Muldoon, Sarah Feldt and Bridgeford, Eric W. and Bassett, Danielle S.",
title = "{Small-World Propensity and Weighted Brain Networks}",
doi = "10.1038/srep22057",
journal = "Scientific Reports",
volume = "6",
number = "1",
pages = "P07027",
year = "2016"
}
[!NOTE]
This software has a GNU AGPL license. If this license is inadequate for your use, please get in touch.
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
Hashes for small_world_propensity-0.0.14.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64fc7eccf9c998809ea880bbf82140fddbf665a22e66b6886cf1e6e98f2a3f9b |
|
MD5 | 15a3bc7ad0cfdf9737840b2464cde41c |
|
BLAKE2b-256 | d079b59cc0cbcdb92b0091a300ccf4cbb1e04bb5a88343d7d5a0bc7b9bebfbfd |
Hashes for small_world_propensity-0.0.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 824a32e6fb7b04cca03da71eee340ab487fbe84c4113fc5453546c08731f71bf |
|
MD5 | e91eb004fc4e0c58a2f4315eb13e76ce |
|
BLAKE2b-256 | 50357cb21d21dd719dbcaec4f7a99066d1e7bad64269972b5ab8b9c1818e7514 |