public class FastLocalMovingAlgorithm extends IterativeCPMClusteringAlgorithm
The fast local moving algorithm first adds all nodes in a network to a queue. It then removes a node from the queue. The node is moved to the cluster that results in the largest increase in the quality function. If the current cluster assignment of the node is already optimal, the node is not moved. If the node is moved to a different cluster, the neighbors of the node that do not belong to the node's new cluster and that are not yet in the queue are added to the queue. The algorithm continues removing nodes from the queue until the queue is empty.
The fast local moving algorithm provides a fast variant of the StandardLocalMovingAlgorithm
.
Modifier and Type | Field and Description |
---|---|
protected java.util.Random |
random
Random number generator.
|
DEFAULT_N_ITERATIONS, nIterations
DEFAULT_RESOLUTION, resolution
Constructor and Description |
---|
FastLocalMovingAlgorithm()
Constructs a fast local moving algorithm.
|
FastLocalMovingAlgorithm(double resolution,
int nIterations,
java.util.Random random)
Constructs a fast local moving algorithm for a specified resolution
parameter and number of iterations.
|
FastLocalMovingAlgorithm(java.util.Random random)
Constructs a fast local moving algorithm.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
improveClusteringOneIteration(Network network,
Clustering clustering)
Improves a clustering by performing one iteration of the fast local
moving algorithm.
|
getNIterations, improveClustering, setNIterations
findClustering
calcQuality, clone, getResolution, removeCluster, removeSmallClustersBasedOnNNodes, removeSmallClustersBasedOnWeight, setResolution
public FastLocalMovingAlgorithm()
public FastLocalMovingAlgorithm(java.util.Random random)
random
- Random number generatorpublic FastLocalMovingAlgorithm(double resolution, int nIterations, java.util.Random random)
resolution
- Resolution parameternIterations
- Number of iterationsrandom
- Random number generatorprotected boolean improveClusteringOneIteration(Network network, Clustering clustering)
The fast local moving algorithm first adds all nodes in a network to a queue. It then removes a node from the queue. The node is moved to the cluster that results in the largest increase in the quality function. If the current cluster assignment of the node is already optimal, the node is not moved. If the node is moved to a different cluster, the neighbors of the node that do not belong to the node's new cluster and that are not yet in the queue are added to the queue. The algorithm continues removing nodes from the queue until the queue is empty.
improveClusteringOneIteration
in class IterativeCPMClusteringAlgorithm
network
- Networkclustering
- Clustering