Library of algorithms for detecting communities in graphs
Project description
communities
communities is a collection of community detection algorithms for graphs. It provides the following algorithms:
- Louvain's modularity
- Girvan-Newman
- Hierarchical clustering (TODO)
- Minimum cut (TODO)
Installation
communities can be installed with pip:
$ pip install communities
Getting Started
Each algorithm expects an adjacency matrix representing an undirected graph. This matrix can either be left-triangular or symmetric. To get started, just import the algorithm you want to use from communities.algorithms, like so:
from communities.algorithms import girvan_newman
adj_matrix = [...]
communities = girvan_newman(adj_matrix)
The output of each algorithm is a list of communities, where each community is a set of nodes.
API
communities.algorithms
louvain_modularity(adj_matrix : list, size : int = None) -> list
girvan_newman(adj_matrix : list, size : int = None) -> list
communities.utilities
is_left_triangular(adj_matrix : list) -> bool
`symmetrize_matrix(adj_matrix : list) -> list
`binarize_matrix(adj_matrix : list, threshold : float = 0.0) -> list
`create_intercommunity_graph(adj_matrix : list, communities : list, aggr : Callable = sum) -> list
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
communities-2.1.0.tar.gz
(5.6 kB
view details)
File details
Details for the file communities-2.1.0.tar.gz.
File metadata
- Download URL: communities-2.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8257f8e9ed6e7d2eae06e0908888b7a3795740f02dbefe62641645a33071e6b7
|
|
| MD5 |
5fa350d9255c1eb76db46cfee1655cdd
|
|
| BLAKE2b-256 |
78e3200ff7cdff6904a4a522d25a87e5d0dae2569c4b7079d3e8a52ef4861c01
|