Skip to main content

Versatility - find how closely a node in a graph is associated with a community

Project description

Versatility

This package implements versatility (Shinn et al., 2017), which describes how closely affiliated a node is with a network community structure. It is written in Python3, and can only be guaranteed to work there. (This MAY work in Python2 if you import __future__ but this is untested... see code for details.)

Install with:

pip3 install versatility

Alternatively, clone the git repo and install with:

python3 setup.py install

Dependencies:

  • Python3
  • networkx
  • Scipy (including numpy and matplotlib)
  • bctpy: The module "bct" is bctpy, a port of the Brain Connectivity Toolbox to Python. The latest version supports Python3, and can be installed most easily with "pip install bcpty".

See function help for full documentation, but the most useful functions are:

  • find_nodal_versatility - Compute the versatility of each node in a graph using a specific community detection algorithm.
  • find_nodal_mean_versatility - Compute the versatility of each node across a spectrum of community detection algorithm parameters (most notably the resolution parameter) and find the average.
  • find_optimal_gamma_curve - Find the mean and standard error of versatility across a spectrum of resolution parameters and (optionally) plot the result. This is most useful for finding the best resolution parameter, e.g. in Figure 3c of the original paper.

Here is a quick example to get you started:

import networkx
from versatility import *
G = networkx.karate_club_graph()
find_nodal_mean_versatility(G, find_communities_louvain, processors=2)
find_nodal_versatility(G, find_communities_louvain, algargs={"gamma" : 0.5})

If you use this code, please cite:

Shinn, M., Romero-Garcia, R., Seidlitz, J., Vasa, F., Vertes, P.,
Bullmore, E. (2017). Versatility of nodal affiliation to
communities. Scientific Reports 7: 4273.
doi:10.1038/s41598-017-03394-5

Copyright 2016-2019 Maxwell Shinn (maxwell.shinn@yale.edu) Available under the GNU GPLv3.

Project details


Download files

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

Source Distribution

versatility-1.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

versatility-1.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file versatility-1.0.1.tar.gz.

File metadata

  • Download URL: versatility-1.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for versatility-1.0.1.tar.gz
Algorithm Hash digest
SHA256 dcd8df6ebf66d5f5a93f445345092e3e877e9489506b324fcaaf0671373642bd
MD5 065e334de595c55b7ab5c876fe58cab2
BLAKE2b-256 821c18e16f8616107a85d2a8545e17347f784f4952c9fbd048cb5fc3204369d5

See more details on using hashes here.

File details

Details for the file versatility-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: versatility-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for versatility-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 713b69403bc0439ba02eab44545843e74a47fad64dbc682ac620c9418ac082f7
MD5 3c1b86a6ea55ba3b3b91ff0233607b27
BLAKE2b-256 5cdbaccabe704a6fd45617b0dfc4ad996a5cab5fab4ebd62a405333b56ef0132

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page