Package org.nlpub.watset.graph
Class ChineseWhispers<V,E>
- java.lang.Object
-
- org.nlpub.watset.graph.ChineseWhispers<V,E>
-
- Type Parameters:
V- the type of nodes in the graphE- the type of edges in the graph
- All Implemented Interfaces:
org.jgrapht.alg.interfaces.ClusteringAlgorithm<V>
public class ChineseWhispers<V,E> extends Object implements org.jgrapht.alg.interfaces.ClusteringAlgorithm<V>
Implementation of the Chinese Whispers algorithm.- See Also:
- Biemann (TextGraphs-1)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChineseWhispers.Builder<V,E>Builder forChineseWhispers.protected static classChineseWhispers.Implementation<V,E>Actual implementation of Chinese Whispers.
-
Field Summary
Fields Modifier and Type Field Description protected org.jgrapht.alg.interfaces.ClusteringAlgorithm.Clustering<V>clusteringThe cached clustering result.protected org.jgrapht.Graph<V,E>graphThe graph.protected intiterationsThe number of iterations.protected RandomrandomThe random number generator.protected NodeWeighting<V,E>weightingThe node weighting approach.
-
Constructor Summary
Constructors Constructor Description ChineseWhispers(org.jgrapht.Graph<V,E> graph, NodeWeighting<V,E> weighting, int iterations, Random random)Create an instance of the Chinese Whispers algorithm.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V,E>
ChineseWhispers.Builder<V,E>builder()Create a builder.org.jgrapht.alg.interfaces.ClusteringAlgorithm.Clustering<V>getClustering()
-
-
-
Field Detail
-
weighting
protected final NodeWeighting<V,E> weighting
The node weighting approach.
-
iterations
protected final int iterations
The number of iterations.
-
random
protected final Random random
The random number generator.
-
clustering
protected org.jgrapht.alg.interfaces.ClusteringAlgorithm.Clustering<V> clustering
The cached clustering result.
-
-
Constructor Detail
-
ChineseWhispers
public ChineseWhispers(org.jgrapht.Graph<V,E> graph, NodeWeighting<V,E> weighting, int iterations, Random random)
Create an instance of the Chinese Whispers algorithm.- Parameters:
graph- the graphweighting- the node weighting approachiterations- the number of iterationsrandom- the random number generator
-
-
Method Detail
-
builder
public static <V,E> ChineseWhispers.Builder<V,E> builder()
Create a builder.- Type Parameters:
V- the type of nodes in the graphE- the type of edges in the graph- Returns:
- a builder
-
-