I think there is some point than is not very well about the function __modularity.
I think the result should write as the below, in the article, the denominator of the function should be 2m. There is a 2 missing.
def __modularity(status, resolution):
"""
Fast compute the modularity of the partition of the graph using
status precomputed
"""
links = float(status.total_weight)
result = 0.
for community in set(status.node2com.values()):
in_degree = status.internals.get(community, 0.)
degree = status.degrees.get(community, 0.)
if links > 0:
result += in_degree * resolution / links - ((degree / (2. * links)) ** 2)
return result
The code bellow is what I want to say:
result += in_degree * resolution / (2. * links) - ((degree / (2. * links)) ** 2)
|
result += in_degree * resolution / links - ((degree / (2. * links)) ** 2) |
I think there is some point than is not very well about the function __modularity.
I think the result should write as the below, in the article, the denominator of the function should be 2m. There is a 2 missing.
The code bellow is what I want to say:
result += in_degree * resolution / (2. * links) - ((degree / (2. * links)) ** 2)python-louvain/community/community_louvain.py
Line 552 in 638804a