Class ChineseWhispers<V,​E>

  • Type Parameters:
    V - the type of nodes in the graph
    E - 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)
    • Field Detail

      • graph

        protected final org.jgrapht.Graph<V,​E> graph
        The graph.
      • 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 graph
        weighting - the node weighting approach
        iterations - the number of iterations
        random - 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 graph
        E - the type of edges in the graph
        Returns:
        a builder
      • getClustering

        public org.jgrapht.alg.interfaces.ClusteringAlgorithm.Clustering<V> getClustering()
        Specified by:
        getClustering in interface org.jgrapht.alg.interfaces.ClusteringAlgorithm<V>