How to set the resolution parameter for Louvain modularity in igraph?
Asked Answered
M

1

6

is there a way to set the resolution parameter when using the function cluster_louvain to detect communities in igraph for R? It makes a lot of difference for the result, as this parameter is related to the hierarchical dissimilarity between nodes. Thank you.

Meacham answered 29/3, 2017 at 17:43 Comment(2)
In the current version they added the resolution parameter in the cluster_louvain() functionAhasuerus
Thank you! I'll take a loot at it.Meacham
A
2

The easiest way to do it is through the resolution package, available in this link https://github.com/analyxcompany/resolution

It is based on this paper http://arxiv.org/pdf/0812.1770.pdf

It pretty much has 2 functions cluster_resolution() and cluster_resolution_RandomOrderFULL(). In both you can state the resolution t and how many repetitions you want rep. And, you can just use the igraph object in the function.

cluster_resolution_RandomOrderFULL(g,t=0.5)
cluster_resolution_RandomOrderFULL(g,rep=20)

NOTE/EDIT: it will not accept signed networks though! I'm trying to either contact the owner of the code or costumize it myself to make it suitable for signed networks.

EDIT2: I was able to translate the function community_louvain.m from the Brain Connectivity Toolbox for Matlab to R.

Here is the github link for the signed_louvain()

you can pretty much just put for ex. signed_louvain(g, gamma = 1, mod = 'modularity') it works with igraph or matrix objects as input. If it has negative values, you have to choose mod = 'neg_sym' or 'neg_asym'.

Aparicio answered 11/9, 2019 at 3:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.