public class LocalMergingAlgorithm extends CPMClusteringAlgorithm
The local merging algorithm starts from a singleton partition. It performs a single iteration over the nodes in a network. Each node belonging to a singleton cluster is considered for merging with another cluster. This cluster is chosen randomly from all clusters that do not result in a decrease in the quality function. The larger the increase in the quality function, the more likely a cluster is to be chosen. The strength of this effect is determined by the randomness parameter. The higher the value of the randomness parameter, the stronger the randomness in the choice of a cluster. The lower the value of the randomness parameter, the more likely the cluster resulting in the largest increase in the quality function is to be chosen. A node is merged with a cluster only if both are sufficiently well connected to the rest of the network.
The local merging algorithm is used in the cluster refinement phase of the
LeidenAlgorithm
.
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_RANDOMNESS
Default randomness parameter.
|
protected java.util.Random |
random
Random number generator.
|
protected double |
randomness
Randomness parameter.
|
DEFAULT_RESOLUTION, resolution
Constructor and Description |
---|
LocalMergingAlgorithm()
Constructs a local merging algorithm.
|
LocalMergingAlgorithm(double resolution,
double randomness,
java.util.Random random)
Constructs a local merging algorithm for a specified resolution
parameter and randomness parameter.
|
LocalMergingAlgorithm(java.util.Random random)
Constructs a local merging algorithm.
|
Modifier and Type | Method and Description |
---|---|
Clustering |
findClustering(Network network)
Finds a clustering of the nodes in a network using the local merging
algorithm.
|
double |
getRandomness()
Returns the randomness parameter.
|
void |
setRandomness(double randomness)
Sets the randomness parameter.
|
calcQuality, clone, getResolution, removeCluster, removeSmallClustersBasedOnNNodes, removeSmallClustersBasedOnWeight, setResolution
public static final double DEFAULT_RANDOMNESS
protected double randomness
protected java.util.Random random
public LocalMergingAlgorithm()
public LocalMergingAlgorithm(java.util.Random random)
random
- Random number generatorpublic LocalMergingAlgorithm(double resolution, double randomness, java.util.Random random)
resolution
- Resolution parameterrandomness
- Randomness parameterrandom
- Random number generatorpublic double getRandomness()
public void setRandomness(double randomness)
randomness
- Randomnesspublic Clustering findClustering(Network network)
The local merging algorithm starts from a singleton partition. It performs a single iteration over the nodes in a network. Each node belonging to a singleton cluster is considered for merging with another cluster. This cluster is chosen randomly from all clusters that do not result in a decrease in the quality function. The larger the increase in the quality function, the more likely a cluster is to be chosen. The strength of this effect is determined by the randomness parameter. The higher the value of the randomness parameter, the stronger the randomness in the choice of a cluster. The lower the value of the randomness parameter, the more likely the cluster resulting in the largest increase in the quality function is to be chosen. A node is merged with a cluster only if both are sufficiently well connected to the rest of the network.
network
- Network