How well a node in a graph is affiliated with a community
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
matlab
README
versatility.py

README

This script 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.)

Dependencies:

- python 3
- networkx
- scipy/numpy/matplotlib
- bctpy: The module "bct" is bctpy, a port of the Brain Connectivity
  Toolbox to Python.  The latest version supports Python3.
  https://github.com/aestrivex/bctpy or "pip install bcpty".  If you
  don't want to install bctpy, it should be pretty easy to modify
  this code to remove the dependency.

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-2017 Maxwell Shinn (maxwell.shinn@yale.edu)
Available under the GNU GPLv3.