pathway.stdlib.graphs.louvain_communities package

Submodules

pathway.stdlib.graphs.louvain_communities.impl module


pathway.stdlib.graphs.louvain_communities.impl.exact_modularity(G, C, round_digits=16)

This function computes modularity of a given weighted graph. This implementation is meant to be used for testing / development. The reason is that it uses exact total weight in the computation, which introduces a lot of edges in recomputation graph. Will perform badly on dynamic datasets, as single weight change will trigger recomputation on all rows. Rounds the modularity to round_digits decimal places (default is 16), for result res it returns round(res, ndigits = round_digits)


pathway.stdlib.graphs.louvain_communities.impl.louvain_level(G, total_weight)

This function, given a weighted graph, finds a clustering that is a local maximum with respect to the objective function as defined by Louvain community detection algorithm