mapequation/infomap

Multi-level network clustering based on the Map Equation

What it solves

Infomap helps you find groups (clusters or communities) inside a network — for example, which people in a social graph hang out together, or which web pages form a topical cluster. It does this using a mathematical framework called the Map equation, which interprets a good partition as one that gives the shortest description of random walks on the network. Infomap turns that idea into a practical tool you can run on graphs from many programming languages.

How it works

Infomap treats a network as nodes (entities) and links (connections between them). It searches for a way to group those nodes into modules so that the Map equation's description length is minimized. You give it a graph — as a NetworkX or igraph object, a sparse matrix, an edge list, a file path, or an iterable of links — and it returns a result containing the detected modules and a codelength value that indicates how good the partition is.

The project ships several interfaces:

  • A Python package (pip install infomap) with a high-level run function that returns an immutable Result, plus a stateful Infomap class for incremental graph construction and repeated runs.
  • An R package with an Infomap object that lets you add links and run the algorithm.
  • A native command-line tool (installable via Homebrew or built from source).
  • A JavaScript package on NPM that provides a browser web worker, a Node.js module, and an infomap CLI.
  • Docker images for both the CLI and a Jupyter notebook environment.

The documentation includes tutorial notebooks and a quickstart for Jupyter.

Who it's for

Researchers, data scientists, and developers who work with network or graph data and need to detect community structure. The multiple language bindings make it accessible from Python, R, Node.js, or a terminal, and the Docker images are useful for reproducible environments.

Highlights

  • Based on the Map equation, a well-known information-theoretic approach to community detection.
  • Official Python, R, JavaScript, Docker, and CLI distributions — no need to compile unless you want to.
  • Works with common Python graph libraries (NetworkX, igraph, pandas) out of the box.
  • Returns an immutable Result object with module assignments and codelength, or convenient community lists with original node labels.
  • Includes a Jupyter notebook image with tutorial notebooks preloaded.
  • Ships shell completion scripts for the CLI and an agent skill for reproducible research workflows.

Related

  • Project
  • Project
  • Project
  • Project