Options
All
  • Public
  • Public/Protected
  • All
Menu

Local merging algorithm.

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.

Hierarchy

Index

Properties

DEFAULT_RESOLUTION: number = 1

Default resolution parameter.

DEFAULT_RANDOMNESS: number = 1e-2

Default randomness parameter.

resolution: number

Resolution parameter.

randomness: number

Randomness parameter.

random: Random

Random number generator.

Methods

  • initializeBasedOnResolution(resolution: number): void
  • getResolution(): number
  • setResolution(resolution: number): void
  • Calculates the quality of a clustering using the CPM quality function.

    The CPM quality function is given by

    1 / (2 * m) * sum(d(c[i], c[j]) * (a[i][j] - resolution * n[i] *
    n[j])),

    where a[i][j] is the weight of the edge between nodes i and j, n[i] is the weight of node i, m is the total edge weight, and resolution is the resolutionparameter. The function d(c[i], c[j]) equals 1 if nodes i and j belong to the same cluster and 0 otherwise. The sum is taken over all pairs of nodes i and j.

    Modularity can be expressed in terms of CPM by setting n[i] equal to the total weight of the edges between node i and its neighbors and by rescaling the resolution parameter by 2 * m.

    Parameters

    Returns number

    Quality of the clustering

  • Removes a cluster from a clustering by merging the cluster with another cluster. If a cluster has no connections with other clusters, it cannot be removed.

    Parameters

    • network: Network

      Network

    • clustering: Clustering

      Clustering

    • cluster: number

      Cluster to be removed

    Returns number

    Cluster with which the cluster to be removed has been merged, or -1 if the cluster could not be removed

  • removeSmallClustersBasedOnNNodes(network: Network, clustering: Clustering, minNNodesPerCluster: number): boolean
  • removeSmallClustersBasedOnWeight(network: Network, clustering: Clustering, minClusterWeight: number): boolean
  • Removes small clusters from a clustering. Clusters are merged until each cluster has at least a certain minimum total node weight.

    The total node weight of a cluster equals the sum of the weights of the nodes belonging to the cluster.

    Parameters

    • network: Network

      Network

    • clustering: Clustering

      Clustering

    • minClusterWeight: number

      Minimum total node weight of a cluster

    Returns boolean

    Boolean indicating whether any clusters have been removed

  • initializeBasedOnRandom(random: Random): void
  • initializeBasedOnResolutionAndRandomnessAndRandom(resolution: number, randomness: number, random: Random): void
  • Initializes a local merging algorithm for a specified resolution parameter and randomness parameter.

    Parameters

    • resolution: number

      Resolution parameter

    • randomness: number

      Randomness parameter

    • random: Random

      Random number generator

    Returns void

  • getRandomness(): number
  • setRandomness(randomness: number): void
  • Finds a clustering of the nodes in a network using the local merging algorithm.

    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.

    Parameters

    Returns Clustering

    Clustering

Constructors

Generated using TypeDoc