Skip to content

jeroenvldj/bimodular_surprise

Repository files navigation

   Python License

Detection of Bimodular Network Structures by Surprise

This code is for the detection of bimodular structures in networks, such as core-periphery and bipartite ones, with the bimodular surprise measure.

Method

Bimodular surprise provides a measure to detect significant bimodular partitions in binary, directed and undirected networks. It is based on the interplay of edge-densities within the clusters and between the clusters. To this end a hypergeometric distribution function is used in similar fashion to surprise for traditional community detection on networks.

Paper - full details on the method

The details and performance of this method can be found in this open-access paper. paper

Code

The code for the bimodular surprise calculation and the heuristic for detection is provided in a jupyter notebook (for now) running on Python 3.5. This notebook contains all explanations about the method, the functions and working examples to show how to use the code.

Example - Running the code

The provided jupyter notebook is written to be self-explanatory and self-contained. Once the provided functions in the notebook are loaded, running the detection algorithm on a network is as simple as:

  1. Loading a network/graph, either as the corresponding adjacency matrix in numpy.array format or as a NetworkX.Graph
G_karate = nx.karate_club_graph() 
  1. Running the detection heuristic
revealed_partition, significance = run_surprise(G=G_karate, is_directed=False)
  1. The revealed partition can be visualized with (node color indicates the two revealed partitions)
nx.draw(G=G_karate, node_color=revealed_partition)

Notes

Please see the jupyter notebook for more details. The extention of this method to weighted networks is in progress.

MIT © Jeroen van Lidth de Jeude - IMT School For Advanced Studies Lucca

"Detectong Core-periphery Structures by Surprise" Jeroen van Lidth de Jeude, Tiziano Squartini, Guido Caldarelli, 12 October 2018

About

Bimodular network structures detection with the bimodular surprise

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published