Skip to content

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

Open

Description

@Green-16

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions