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.
Metadata
Release files for small-world-propensity 0.0.19
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| small_world_propensity-0.0.19.tar.gz | 17.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| small_world_propensity-0.0.19-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.9 kB
Release files / small_world_propensity-0.0.19.tar.gz
| Download URL | small_world_propensity-0.0.19.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5bb1dadc86fd1155633e5c1f3e70cb46f0041819023758b03d27e24b9796afd0
|
|
BLAKE2b-256 checksum How to use checksums |
0c74108ec2f66e032fe2d0e40304e0e74a92ad995533600a4010f8dc91e125c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / small_world_propensity-0.0.19-py3-none-any.whl
| Download URL | small_world_propensity-0.0.19-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7262f4f8d8d9406c0fc8cba65cda59a9917c66ecc0180c74a4cfe5d8e07e0bb0
|
|
BLAKE2b-256 checksum How to use checksums |
3d36221f53bec76bf2a4f03832b4566a1a8e0dfd5c96a2d2cb8f546bd53ec107
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for small-world-propensity 0.0.19
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.