Clustering, density estimation, and anomaly detection · Graph and community clustering · UCL029 · Algorithm
Chinese Whispers
Cluster a weighted graph with a fast randomized label-propagation procedure. It was introduced for natural-language graphs and works well as a lightweight exploratory grouping method when many vertices have sparse local…
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page. The methods that run it are Experimental.
- Network communities Experimental
Do it in CodeSplash Run it on your own data. It's in the Experimental lane in the app.
- Availability
- Runs in CodeSplash (Experimental)
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through discover.communities. The reference's example ran here in one language.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Cluster a weighted graph with a fast randomized label-propagation procedure. It was introduced for natural-language graphs and works well as a lightweight exploratory grouping method when many vertices have sparse local connections.
Question / hypotheses
Which partition or latent block structure best explains the supplied graph relationships? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.
Architecture / computational structure
Random asynchronous weighted label votes over graph adjacency lists.
Assumptions
There is no prespecified cluster count. Update order matters because labels are usually updated asynchronously. Dense graphs or dominant hubs can cause one label to spread excessively; disconnected components cannot merge.
Formula / computational definition
Initialize a distinct label per vertex. Visit vertices in randomized order and set . Labels spread according to local weighted majority; the process stops after stabilization or a pass limit.
Parameters and notation
Learned or fitted quantities: Vertex labels after propagation. User-set hyperparameters/design choices: Define graph edges, weights, tie rules, pass limit, and seed. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.
Fitting, fine-tuning, and adaptation
Neural fine-tuning is not applicable. Refit after material edge or weight changes and compare several initializations. Warm-starting a partition can help computation but may preserve an obsolete solution; use the same graph construction when comparing versions.
How to use and calibrate
Compare repeated runs using partition agreement, group-size distributions, and application-specific coherence. Report unstable vertices instead of treating one stochastic labeling as uniquely correct. Standard likelihood or p-value interpretations do not apply.
Example application
Group related words connected by weighted co-occurrence edges. Define the reference population, measurement units, and success criterion before fitting; investigate whether discovered groups or alerts reflect the intended phenomenon.
Interpretation / pitfalls
Watch out
The reported result is conditional on the representation and objective. A stable partition can reflect nuisance structure such as batch, collection site, or missingness. Confirm the interpretation in original variables and an independent sample.
Python and R code examples
Implement the weighted label update directly with adjacency lists in either language. The paired component illustrates one vertex update; full fitting additionally needs random sweeps, tie policy, and a stable stopping condition. The original paper supplies the method specification.
Component: Chinese Whispers weighted vote for one vertex. Python: executed successfully; R: not executed (Rscript unavailable). These small fixtures establish the arithmetic operation, not full-method accuracy or reproduction of paper results.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — Chinese Whispers weighted vote for one vertex. · needs numpy
import numpy as np
neighbor_labels=np.array([1,1,2]); weights=np.array([.4,.3,.8])
votes=np.bincount(neighbor_labels,weights=weights,minlength=3)
result=np.array([votes[1],votes[2],np.argmax(votes)])
print(result)
Component demo, not a trained model — Chinese Whispers weighted vote for one vertex.
neighbor_labels=c(1,1,2); weights=c(.4,.3,.8)
votes=tapply(weights,neighbor_labels,sum); result=c(votes,label=as.numeric(names(which.max(votes))))
print(result)
Sources
- Source 1aclanthology.org
From the CodeSplash reference, entry UCL029.