cdlib.algorithms.chinesewhispers

chinesewhispers(g_original: object, weighting: str = 'top', iterations: int = 20, seed: int = None) → cdlib.classes.node_clustering.NodeClustering

Fuzzy graph clustering that (i) creates an intermediate representation of the input graph, which reflects the “ambiguity” of its nodes, and (ii) uses hard clustering to discover crisp clusters in such “disambiguated” intermediate graph.

Supported Graph Types

Undirected Directed Weighted
Yes No Yes
Parameters:
  • g_original
  • weighting – edge weighing schemas. Available modalities: [‘top’, ‘lin’, ‘log’]
  • iterations – number of iterations
  • seed – random seed
Returns:

NodeClustering object

Example:
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> coms = algorithms.chinesewhispers(G)
References:

Biemann, Chris. 2006. Chinese Whispers: An Efficient Graph Clustering Algorithm and Its Application to Natural Language Processing Problems. In Proceedings of the First Workshop on Graph Based Methods for Natural Language Processing, TextGraphs-1, pages 73–80, Association for Computational Linguistics, New York, NY, USA.

Note

Reference implementation: https://github.com/nlpub/chinese-whispers-python