You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed louvain-igraph gave different modularity values than I expected, and I found a small example where it seems the package is not taking the weights into account:
With my own calculations, as well as through other implementations, I find an (optimal) modularity value of 0.423 for this partiton. The modularity value of 0.357 is valid for the non-weighted equivalent of the graph.
Am I overlooking something or is this a bug in the code?
The text was updated successfully, but these errors were encountered:
Thanks, I'll look into it! The code is tested on weighted graphs, so in principle it should work. I'm not sure what is going on here, I'll have to take a closer look.
Initially, I overlooked it, but you are looking at the modularity that is provided by igraph by default. This is indeed an unweighted variant. To get the quality value of the partition, you should call part.quality(), which does provide the corrected weighted modularity. The confusion is understandable, I'll see if I can remove the modularity variable in some way.
The modularity variable cannot be removed easily, and it would also create an inconsistency with the existing API from igraph, so I am leaving it as is. So, to get the quality of the partition, you always have to call partition.quality(), also when using louvain.ModularityVertexPartition.
I noticed louvain-igraph gave different modularity values than I expected, and I found a small example where it seems the package is not taking the weights into account:
Gives output:
With my own calculations, as well as through other implementations, I find an (optimal) modularity value of 0.423 for this partiton. The modularity value of 0.357 is valid for the non-weighted equivalent of the graph.
Am I overlooking something or is this a bug in the code?
The text was updated successfully, but these errors were encountered: