cdlib.evaluation.ecs

cdlib.evaluation.ecs(first_partition: object, second_partition: object, alpha: float = 0.9, r: float = 1.0, r2: float | None = None, rescale_path_type: str = 'max', ppr_implementation: str = 'prpack') MatchingResult

The element-centric clustering similarity.

Parameters:
  • first_partition – NodeClustering object

  • second_partition – NodeClustering object

  • alpha – The personalized page-rank return probability as a float in [0,1]. float, default 0.9

  • r – The hierarchical scaling parameter for clustering1. float, default 1.0

  • r2 – The hierarchical scaling parameter for clustering2. float, default None

  • rescale_path_type – rescale the hierarchical height by: ‘max’ the maximum path from the root; ‘min’ the minimum path form the root; ‘linkage’ use the linkage distances in the clustering.

  • ppr_implementation – Choose an implementation for personalized page-rank calculation: ‘prpack’ use PPR algorithms in igraph; ‘power_iteration’: use power_iteration method.

Returns:

MatchingResult object

Example:

>>> from cdlib import evaluation, algorithms
>>> import networkx as nx
>>> g = nx.karate_club_graph()
>>> louvain_communities = algorithms.louvain(g)
>>> leiden_communities = algorithms.leiden(g)
>>> evaluation.ecs(louvain_communities,leiden_communities)
Reference:

A.J. Gates, I.B. Wood, W.P. Hetrick, and YY Ahn [2019]. “Element-centric clustering comparison unifies overlaps and hierarchy”. Scientific Reports 9, 8574

Note

The function requires the clusim library to be installed. You can install it via pip: pip install clusim