cdlib.evaluation.avg_transitivity¶
-
avg_transitivity
(graph: <Mock id='140160383588304'>, communities: object, **kwargs) → object¶ Average transitivity.
The average transitivity of a community is defined the as the average clustering coefficient of its nodes w.r.t. their connection within the community itself.
Parameters: - 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.
Returns: If summary==True a FitnessResult object, otherwise a list of floats.
Example:
>>> from cdlib.algorithms import louvain >>> from cdlib import evaluation >>> g = nx.karate_club_graph() >>> communities = louvain(g) >>> scd = evaluation.avg_transitivity(g,communities)