Infomap Python API

Infomap is a network clustering algorithm based on the Map equation. This site documents the Python package: installation, a quick start, usage patterns for NetworkX, igraph and multilayer graphs, and the full API reference.

Quick start

pip install infomap
import networkx as nx
import infomap

graph = nx.karate_club_graph()
communities = infomap.find_communities(graph, seed=123, num_trials=20)

print(communities)

Continue to Installation for optional integrations and shell completion, or jump to Quick start for the first end-to-end example.

For Jupyter, start with the flagship quickstart notebook. It shows the notebook-native Infomap result summary, dataframe inspection, and a copyable static network partition helper.

Where to go next

  • Installation — install the package, optional integrations, and the infomap CLI entry point.

  • Quick start — the shortest path from pip install to a partition.

  • Tutorial notebooks — survey companion notebooks for learning the map equation and adapting Infomap workflows.

  • Usage — NetworkX, igraph, state and multilayer networks, reusable options, and a migration guide for users of other community-detection packages.

  • Export GraphML and GEXF — write Infomap module assignments to GraphML and GEXF for visualization tools.

  • Using Infomap with AnnData and Scanpy — run Infomap on AnnData graphs in Scanpy-style single-cell workflows.

  • API reference — full API reference, split into top-level functions, the infomap.Infomap class, options, and tree iterators.

External resources