Skip to main content

agglom_cluster

Agglomerative clustering tool for network-x graphs

Clustering

Implements the algorithm described by: “Fast algorithm for detecting community structure in networks” M. E. J. Newman. 2004 http://arxiv.org/pdf/cond-mat/0309508v1.pdf This is a greedy agglomerative hierarchical clustering algorithm. The alogorithm efficiently clusters large number of nodes (this is one of the best scaling clustering algorithms) while producing a suggested number of clusters. See papers on scaling and accuracy questions regarding greedy Newman.

This implementation uses a heap to select the best pair to cluster at each iteration - A naive implementation considers all “n” edges in the graph (O(n)) - A heap reduces this search dramatically (O(log(n))

Dependencies

allset – for automatic module importing networkx – supported graphing library

Problems

  • The actual Modularity score does not exactly match the Modularity score of the example on the wikipedia page

  • http://en.wikipedia.org/wiki/Modularity_(networks)

  • Does not work for directed graphs (TODO operate on the undirected graph)

  • Does not work for negative graphs (TODO add this capability)

  • Does not handle disconnected components (unless than are components of size 1)

  • Clustering needs to move to a function call rather than an object holder (return dendrogram object)

  • Node relabeling is messy

  • Dendrogram crawling is used for two separate purposes which aren’t clearly defined/called

Attributes

NewmanGreedy objects store the following attributes * Supergraph - Duplicate of the original graph. Gets manipulated during the clustering: edges and nodes are condensed and reweighted - Cluster degree stored in node attribute - Number of connections between clusters stored in edge attribute (weighted edge) - Implicitly keeps track of the existing nodes which is required for the heap * Dendrogram - Stores the clustering history in a tree * Heap - Stores the modularity quality difference for combining each pair of existing nodes - Popping returns the node pair with the largest modulairty/quality difference, then smallest id1, then smallest id2 * Stored as a tuple (value, id1, id2) where the modularity/value is negated, and id1 is the smaller of the two * Processing the smaller IDs first means that smaller clusters will be chosen first during modularity tie breaking - Non-existing nodes are not actively removed from the heap, so pairs with non-existing nodes are ignored when popping * Quality History - Charts the Modularity score for each number of clustering

Author

Author(s): Ethan Lozano & Matthew Seal

Collaborator(s): Zubin Jelveh

Metadata

Release files for AgglomCluster 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AgglomCluster 1.0.2
File Size Uploaded Provenance Actions
AgglomCluster-1.0.2.zip 20.7 kB Without provenance Details for AgglomCluster-1.0.2.zip

Release files / AgglomCluster-1.0.2.zip

Download URL AgglomCluster-1.0.2.zip
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
93d94a3fd2b7d602ae925dec8ca7f5c838732ea640d94d146738fcf253f63afb
BLAKE2b-256 checksum
How to use checksums
e07cc47754f8075537d3995ec33ffab3a41a74edb07a31ad3812b687b5aa4a3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for AgglomCluster 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page