Closed whatever60 closed 2 years ago
Hi there, good spot.
It seems that the discrepancy comes from the fact that there is a factor 2 in the $\delta e$ term in your derivation. The code implementation in lines 487-488 and lines 494-495 excludes the coefficient 2, which does not affect the result.
It might be helpful to look at the equation (2) in the original Louvain paper: https://iopscience.iop.org/article/10.1088/1742-5468/2008/10/P10008/meta, which also appears in issue #71 .
Thanks, indeed this coefficient does not affect the results
Thank you Lizhi.
Hi, there is my question about how the modularity is calculated during node moving.
I think the following code —
https://github.com/taynaud/python-louvain/blob/0be2657088ace315959f44e2b02030c597cf63a3/community/community_louvain.py#L483-L502
comes from such derivation —
And to my best understanding,
degc_totw
representswhere node c moves from community x to community y, and capital K is the degree of community and lowercase k is degree of node. (I omit resolution there).
So, where is the coefficient 2? Thank you.