Skip to content

Adds modularity measure for communities.#1729

Merged
hagberg merged 2 commits intonetworkx:masterfrom
jfinkels:modularity
Jan 15, 2017
Merged

Adds modularity measure for communities.#1729
hagberg merged 2 commits intonetworkx:masterfrom
jfinkels:modularity

Conversation

@jfinkels
Copy link
Copy Markdown
Contributor

This is from pull request #764. I made PEP8 and style fixes.

@hagberg
Copy link
Copy Markdown
Member

hagberg commented Dec 27, 2015

Need to fix conflicts and coordinate with #1733

from .community_utils import is_partition


def modularity(G, communities, weight='weight'):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't we have a name conflict/confusion here with modularity used as both the function and module name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean for references in the documentation? In general having a module-level attribute with the same name as a module is fine: datetime.datetime for example.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course you can. But bad stuff is more likely to happen #2087 and another recent case I can't remember right now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A possible solution might be to add modularity to quality.py instead of adding a new module modularity.py.

@hagberg
Copy link
Copy Markdown
Member

hagberg commented Apr 16, 2016

Needs merge conflict update.

@hagberg hagberg merged commit 8f1bcdf into networkx:master Jan 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants