In this article Martijn Gösgens explains the community detection method 'modularity' for networks. He describes an interpretation of modularity in terms of Bayesian statistics and explains a phase transition in the corresponding prior distribution. Gösgens finished his PhD supervised by Remco van der Hofstad and Nelly Litvak. This article was written on the occasion of the VVS-OR Van Zwet PhD thesis award Gösgens received on 20 March 2025.