simulatedAnnealing
is only based on moving a single vertex from one community to another, while saIndividualCollectiveMoves
considers movements of vertices, merging of communities and splitting of communities as alternatives to increase the modularity.
simulatedAnnealing(adjacency, numRandom = 0, initial = c("general", "random","greedy", "own"), beta = length(adjacency[1, ])/2, alpha = 1.005, fixed)
saIndividualCollectiveMoves(adjacency,numRandom=0,initial=c("general","own"), beta=length(adjacency[1,])/2,alpha=1.005, fixed=25,numIter=1.0)
Default
is (network size)/2
Default
is 1.005
numRandom>0
numRandom>0
numRandom>0
The initial partition used in the simulated annealing algorithms can either be the generic one where all vertices are put in their own community (initial=general
) or the initial partition can be identified by randomly identifying the initial number of communities and randomly assigning the vertices to one of these communities (initial=random
) or the initial partition can be the community structure identified by the greedy algorithm (initial=greedy
) or the initial partition can be given by the user (initial=own
). In this case, the user needs to add a last column to the adjacency matrix indicating the initial partition. Hence, the adjacency matrix has to have one column more than the network has vertices.
Massen, C. and Doye, J. Identifying communities within energy landscapes. Phys. Rev. E, 71:046101, Apr 2005.
Guimera, R. and Amaral, L. A. N. Nunes amaral. Functional cartography of complex metabolic networks. Nature, 2005.
#unweighted network
randomgraph <- erdos.renyi.game(10, 0.3, type="gnp",directed = FALSE, loops = FALSE)
#to ensure that the graph is connected
vertices <- which(clusters(randomgraph)$membership==1)
graph <- induced.subgraph(randomgraph,vertices)
adj <- get.adjacency(graph)
result <- simulatedAnnealing(adj, fixed=10)
Run the code above in your browser using DataLab