public class LouvainAlgorithm extends IterativeCPMClusteringAlgorithm
The Louvain algorithm consists of two phases:
These phases are repeated until no further improvements can be made. By
default, local moving of nodes is performed using the StandardLocalMovingAlgorithm
.
Modifier and Type | Field and Description |
---|---|
protected IncrementalCPMClusteringAlgorithm |
localMovingAlgorithm
Local moving algorithm.
|
DEFAULT_N_ITERATIONS, nIterations
DEFAULT_RESOLUTION, resolution
Constructor and Description |
---|
LouvainAlgorithm()
Constructs a Louvain algorithm.
|
LouvainAlgorithm(double resolution,
int nIterations,
IncrementalCPMClusteringAlgorithm localMovingAlgorithm)
Constructs a Louvain algorithm for a specified resolution parameter,
number of iterations, and local moving algorithm.
|
LouvainAlgorithm(double resolution,
int nIterations,
java.util.Random random)
Constructs a Louvain algorithm for a specified resolution parameter and
number of iterations.
|
LouvainAlgorithm(java.util.Random random)
Constructs a Louvain algorithm.
|
Modifier and Type | Method and Description |
---|---|
LouvainAlgorithm |
clone()
Clones the algorithm.
|
IncrementalCPMClusteringAlgorithm |
getLocalMovingAlgorithm()
Returns the local moving algorithm.
|
protected boolean |
improveClusteringOneIteration(Network network,
Clustering clustering)
Improves a clustering by performing one iteration of the Louvain
algorithm.
|
void |
setLocalMovingAlgorithm(IncrementalCPMClusteringAlgorithm localMovingAlgorithm)
Sets the local moving algorithm.
|
void |
setResolution(double resolution)
Sets the resolution parameter.
|
getNIterations, improveClustering, setNIterations
findClustering
calcQuality, getResolution, removeCluster, removeSmallClustersBasedOnNNodes, removeSmallClustersBasedOnWeight
protected IncrementalCPMClusteringAlgorithm localMovingAlgorithm
public LouvainAlgorithm()
public LouvainAlgorithm(java.util.Random random)
random
- Random number generatorpublic LouvainAlgorithm(double resolution, int nIterations, java.util.Random random)
resolution
- Resolution parameternIterations
- Number of iterationsrandom
- Random number generatorpublic LouvainAlgorithm(double resolution, int nIterations, IncrementalCPMClusteringAlgorithm localMovingAlgorithm)
resolution
- Resolution parameternIterations
- Number of iterationslocalMovingAlgorithm
- Local moving algorithmpublic LouvainAlgorithm clone()
clone
in class CPMClusteringAlgorithm
public IncrementalCPMClusteringAlgorithm getLocalMovingAlgorithm()
public void setResolution(double resolution)
setResolution
in class CPMClusteringAlgorithm
resolution
- Resolution parameterpublic void setLocalMovingAlgorithm(IncrementalCPMClusteringAlgorithm localMovingAlgorithm)
localMovingAlgorithm
- Local moving algorithmprotected boolean improveClusteringOneIteration(Network network, Clustering clustering)
The Louvain algorithm consists of two phases:
These phases are repeated until no further improvements can be made.
improveClusteringOneIteration
in class IterativeCPMClusteringAlgorithm
network
- Networkclustering
- Clustering