localModularity: Algorithms using local modularity

Description Usage Arguments Details Value Author(s) References Examples

Description

localModularity uses the local modularity to identify the local community structure around a certain vertex

localModularityWang uses the local modularity to identify the community structure of the entire network

Usage

1
2
localModularity(adjacency, srcV, k)
localModularityWang(adjacency,numRandom=0)

Arguments

adjacency

A nonnegative symmetric adjacency matrix of the network whose community structur will be analyzed

srcV

A given vertex whose local community structure should be determined by
localModularity

k

The maximum number of vertices to add to the local community of srcV

numRandom

The number of random networks with which the modularity of the resulting community structure should be compared (default: no comparison). see details below for further explanation of the used null model.

Details

The used random networks have the same number of vertices and the same degree distribution as the original network.

Value

The result for localModularity is returned as a list with the following components

local community
structure

Vertices assigned to the same community as the source vertex srcV

local modularity

The local modularity value for the determined local community

The result for localModularityWang is returned as a list with the following components

number of communities

The number of communities detected by the algorithm

modularity

The modularity of the detected community structure

mean

The mean of the modularity values for random networks, only computed if numRandom>0

standard deviation

The standard deviation of the modularity values for random networks, only computed if numRandom>0

community structure

The community structure of the examined network given by a vector assigning each vertex its community number

random modularity values

The list of the modularity values for random networks, only computed if
numRandom>0

Author(s)

Maria Schelling, Cang Hui

References

Clauset, A. Finding local community structure in networks. Phys. Rev. E, 72:026132, Aug 2005.

Wang, X., Chen, G. and Lu, H. A very fast algorithm for detecting community structures in complex networks. Physica A: Statistical Mechanics and its Applications, 384(2):667-674, 2007.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#unweighted network
randomgraph1 <- erdos.renyi.game(10, 0.3, type="gnp",directed = FALSE, loops = FALSE)

#to ensure that the graph is connected
vertices1 <- which(clusters(randomgraph1)$membership==1)  
graph1 <- induced.subgraph(randomgraph1,vertices1)

adj1 <- get.adjacency(graph1)
result1 <- localModularity(adj1, srcV=1, k=4)

#weighted network
randomgraph2 <- erdos.renyi.game(10, 0.3, type="gnp",directed = FALSE, loops = FALSE)

#to ensure that the graph is connected
vertices2 <- which(clusters(randomgraph2)$membership==1)  
graph2 <- induced.subgraph(randomgraph2,vertices2)
graph2 <- set.edge.attribute(graph2, "weight", value=runif(ecount(graph2),0,1))

adj2 <- get.adjacency(graph2, attr="weight")
result2 <- localModularityWang(adj2)

Example output

Loading required package: gtools
Loading required package: igraph

Attaching package: 'igraph'

The following object is masked from 'package:gtools':

    permute

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

modMax documentation built on May 2, 2019, 12:20 p.m.