cluster_leading_eigen(graph, steps = -1, weights = NULL, start = NULL,
options = arpack_defaults, callback = NULL, extra = NULL,
env = parent.frame())
NA
NULL
, or a numeric membership vector, giving the start
configuration of the algorithm.NULL
, then it must be callback function. This
is called after each iteration, after calculating the leading eigenvector of
the modularity matrix. See details below.cluster_leading_eigen
returns a named list with the
following members:membership
member.
This is a two-column matrix and each line describes a merge of two
communities, the first line is the first merge and it creates community
N
N
is the number of initial communities in the
graph, the second line creates community N+1
, etc.arpack
for details.The heart of the method is the definition of the modularity matrix,
B
, which is B=A-P
, A
being the adjacency matrix of the
(undirected) network, and P
contains the probability that certain
edges are present according to the P[i,j]
element of P
is the probability that there is
an edge between vertices i
and j
in a random network in which
the degrees of all vertices are the same as in the input graph.
The leading eigenvector method works by calculating the eigenvector of the modularity matrix for the largest positive eigenvalue and then separating vertices into two community based on the sign of the corresponding element in the eigenvector. If all elements in the eigenvector are of the same sign that means that the network has no underlying comuunity structure. Check Newman's paper to understand why this is a good method for detecting community structure.
modularity
, cluster_walktrap
,
cluster_edge_betweenness
,
cluster_fast_greedy
, as.dendrogram
g <- make_full_graph(5) %du% make_full_graph(5) %du% make_full_graph(5)
g <- add_edges(g, c(1,6, 1,11, 6, 11))
lec <- cluster_leading_eigen(g)
lec
cluster_leading_eigen(g, start=membership(lec))
Run the code above in your browser using DataCamp Workspace