cdlib.algorithms.infomap

infomap(g_original: object, flags: str = '') → cdlib.classes.node_clustering.NodeClustering

Infomap is based on ideas of information theory. The algorithm uses the probability flow of random walks on a network as a proxy for information flows in the real system and it decomposes the network into modules by compressing a description of the probability flow.

NB: in case the Infomap package is not installed/installable (e.g., on M1 silicon Macs), the implementation used is the one from the igraph library.

Supported Graph Types

Undirected Directed Weighted
Yes Yes Yes
Parameters:
  • g_original – a networkx/igraph object
  • flags – str flags for Infomap
Returns:

NodeClustering object

Example:
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> coms = algorithms.infomap(G)
References:

Rosvall M, Bergstrom CT (2008) Maps of random walks on complex networks reveal community structure. Proc Natl Acad SciUSA 105(4):1118–1123

Note

Reference implementation: https://pypi.org/project/infomap/

Note

Infomap Python API documentation: https://mapequation.github.io/infomap/python/