Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there some problem about the algorithm of modularity in function __modularity. #98

Open
Green-16 opened this issue Aug 25, 2022 · 0 comments

Comments

@Green-16
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant