Skip to content

pymocd

Evolutionary community detection for Python, with the heavy lifting done in parallel Rust.

Getting started API reference

pip install pymocd
Rust + PyO3 core Rayon parallelism on every core
NSGA-II · NSGA-III · PESA-II Multi-objective evolutionary engines
GPL-3.0-or-later Free and open source
  • Fast by construction


    The core is written in Rust with PyO3 bindings and Rayon data parallelism — evolutionary search scales across every core you give it with max_cores.

  • Drop-in for NetworkX and igraph


    Pass your networkx.Graph or igraph.Graph directly. Every detector returns a plain dict mapping node to community.

  • Learn by example


    Plot detected communities, plug in custom objectives, and walk Pareto fronts with copy-paste-runnable examples.

    Examples

Citing pymocd

If you use any of these algorithms in your research, please cite the HP-MOCD paper (SNAM, 2025):

@article{Santos2025,
  author    = {Santos, Guilherme O. and Vieira, Lucas S. and Rossetti, Giulio and Ferreira, Carlos H. G. and Moreira, Gladston J. P.},
  title     = {A high-performance evolutionary multiobjective community detection algorithm},
  journal   = {Social Network Analysis and Mining},
  year      = {2025},
  volume    = {15},
  number    = {1},
  pages     = {110},
  doi       = {10.1007/s13278-025-01519-7},
  url       = {https://doi.org/10.1007/s13278-025-01519-7},
  issn      = {1869-5469},
  date      = {2025-11-18}
}