linkRankOptimalPartition: LinkRank Modularity Optimization

View source: R/LinkRankOptimalPartition.R

linkRankOptimalPartitionR Documentation

LinkRank Modularity Optimization

Description

Computes the optimal partition of a network, based on LinkRank Modularity.

Usage

linkRankOptimalPartition(
  qlrM,
  A,
  c,
  Tc = 1,
  minTc = 1e-10,
  cool = 0.995,
  max_itry,
  max_heat,
  max_rej,
  plots = F,
  location = getwd()
)

Arguments

qlrM

LinkRank Modularirty Matrix. Output of LinkRankModMatrix function

A

Alternatively, the network adjacency matrix can be provided.

c

Initial partition vector. Default to c = 1:n

Tc

Initial temperature

minTc

Minimal temperature

cool

System cooling factor

max_itry

Number of iterations in each temperature. Default to "n^2"

max_heat

Maximal consecutive heat changes in each temperature. Default to "n".

max_rej

Maximal consecutive rejection changes in each temperature. Default to "n".

plots

Logical. If TRUE plots the progres of the algorithm. Requires network adjacency matrix and "statnet" package. Default to FALSE

location

Directory to save the plots described above.

Details

This function computes the optimal partition of a network, based on LinkRank Modularity [1]. The simulated annealing algorithm [2] is used during the community identifying process. Only simple movements between groups are tested. It does not test group movements.

Value

Numeric vector, with the optimal partition found.

References

[1] Kim Y, Son SW, Jeong H (2010). "Finding Communities in Directed Networks." Physical Review E 81, 016103. doi: 10.1103/PhysRevE.81.016103

[2] Kirkpatrick S, Gelatt CDJ, Vecchi MP (1983). "Optimization by Simulated Annealing." Science 220 (May (4598)), 671-680. https://pubmed.ncbi.nlm.nih.gov/17813860/

Examples

# An arbitrary adjacency matrix for a network with 16 nodes
# based on an example from Ref.[1]

adj <- structure(c(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0),
                 .Dim = c(16L, 16L), .Dimnames = list(NULL, NULL))
                 
# Calculates the optimal partition of a given network
linkRankOptimalPartition(A = adj)

leb-fmvz-usp/epinemo documentation built on Nov. 27, 2022, 10:58 p.m.