Package org.nlpub.watset.graph
Class ChineseWhispers.Builder<V,E>
- java.lang.Object
-
- org.nlpub.watset.graph.ChineseWhispers.Builder<V,E>
-
- Type Parameters:
V- the type of nodes in the graphE- the type of edges in the graph
- All Implemented Interfaces:
ClusteringBuilder<V,E,ChineseWhispers<V,E>>
- Enclosing class:
- ChineseWhispers<V,E>
public static class ChineseWhispers.Builder<V,E> extends Object implements ClusteringBuilder<V,E,ChineseWhispers<V,E>>
Builder forChineseWhispers.
-
-
Field Summary
Fields Modifier and Type Field Description static intITERATIONSThe default number of Chinese Whispers iterations.
-
Constructor Summary
Constructors Constructor Description Builder()Create an instance ofChineseWhispersbuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChineseWhispers<V,E>build(org.jgrapht.Graph<V,E> graph)Construct an instance of the clustering algorithm with the parameters specified in the builder.Function<org.jgrapht.Graph<V,E>,Clustering<V>>provider()Construct a factory function that sets up the algorithm for the given graph.ChineseWhispers.Builder<V,E>setIterations(int iterations)Set the maximal number of iterations.ChineseWhispers.Builder<V,E>setRandom(Random random)Set the random number generator.ChineseWhispers.Builder<V,E>setWeighting(NodeWeighting<V,E> weighting)Set the the node weighting approach.
-
-
-
Field Detail
-
ITERATIONS
public static final int ITERATIONS
The default number of Chinese Whispers iterations.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Builder
public Builder()
Create an instance ofChineseWhispersbuilder.
-
-
Method Detail
-
build
public ChineseWhispers<V,E> build(org.jgrapht.Graph<V,E> graph)
Description copied from interface:ClusteringBuilderConstruct an instance of the clustering algorithm with the parameters specified in the builder.- Specified by:
buildin interfaceClusteringBuilder<V,E,ChineseWhispers<V,E>>- Parameters:
graph- the graph- Returns:
- a fully-configured clustering algorithm
-
provider
public Function<org.jgrapht.Graph<V,E>,Clustering<V>> provider()
Description copied from interface:ClusteringBuilderConstruct a factory function that sets up the algorithm for the given graph.- Specified by:
providerin interfaceClusteringBuilder<V,E,ChineseWhispers<V,E>>- Returns:
- a factory function that sets up the algorithm for the given graph
-
setWeighting
public ChineseWhispers.Builder<V,E> setWeighting(NodeWeighting<V,E> weighting)
Set the the node weighting approach.- Parameters:
weighting- the node weighting approach- Returns:
- the builder
-
setIterations
public ChineseWhispers.Builder<V,E> setIterations(int iterations)
Set the maximal number of iterations.- Parameters:
iterations- the maximal number of iterations- Returns:
- the builder
-
setRandom
public ChineseWhispers.Builder<V,E> setRandom(Random random)
Set the random number generator.- Parameters:
random- the random number generator- Returns:
- the builder
-
-