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.
Failed to load latest commit information.


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


- 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. 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.

Copyright 2016-2017 Maxwell Shinn (
Available under the GNU GPLv3.