scaled_density(graph: <Mock id='140619399398224'>, communities: object, **kwargs) → object¶
The scaled density of a community is defined as the ratio of the community density w.r.t. the complete graph density.
- graph – a networkx/igraph object
- communities – NodeClustering object
- summary – boolean. If True it is returned an aggregated score for the partition is returned, otherwise individual-community ones. Default True.
If summary==True a FitnessResult object, otherwise a list of floats.
>>> from cdlib.algorithms import louvain >>> from cdlib import evaluation >>> g = nx.karate_club_graph() >>> communities = louvain(g) >>> scd = evaluation.scaled_density(g,communities)