Implementation of the Louvain method for community detection using R code