condorMatrixModularity | R Documentation |
This function is based on the bipartite modularity
as defined in "Modularity and community detection in bipartite networks"
by Michael J. Barber, Phys. Rev. E 76, 066102 (2007)
This function uses a slightly different implementation from the paper. It
does not use the "adaptive BRIM" method for identifying the number of
modules. Rather, it simply continues to iterate until the difference in
modularity between iterations is less that 10^-4. Starting from a random
initial condition, this could take some time. Use
condorCluster
for quicker runtimes and likely better
clustering, it initializes the blue
node memberships by projecting the blue nodes into a unipartite "blue"
network and then identify communities in that network using a standard
unipartite community detection algorithm run on the projected network.
See condorCluster
for more details on that.
This function loads the entire adjacency matrix in memory, so if your
network has more than ~50,000 nodes, you may want to use
condorModularityMax
, which is slower, but does not store
the matrices in memory. Or, of course, you could move to a larger machine.
condorMatrixModularity(
condor.object,
T0 = cbind(seq_len(q), rep(1, q)),
weights = 1,
deltaQmin = "default"
)
condor.object |
is a list created by
|
T0 |
is a two column data.frame with the initial community assignment for each "blue" node, assuming there are more reds than blues, though this is not strictly necessary. The first column contains the node name, the second column the community assignment. |
weights |
edgeweights for each edge in |
deltaQmin |
convergence parameter determining the minimum required increase
in the modularity for each iteration. Default is min(10^-4,1/(number of edges)),
with number of edges determined by |
Qcoms data.frame with modularity of each community.
modularity modularity value after each iteration.
red.memb community membership of the red nodes
blue.memb community membership of the blue.nodes
r = c(1,1,1,2,2,2,3,3,3,4,4);
b = c(1,2,3,1,2,4,2,3,4,3,4);
reds <- c("Alice","Sue","Janine","Mary")
blues <- c("Bob","John","Ed","Hank")
elist <- data.frame(red=reds[r],blue=blues[b])
condor.object <- createCondorObject(elist)
#randomly assign blues to their own community
T0 <- data.frame(nodes=blues,coms=seq_len(4))
condor.object <- condorMatrixModularity(condor.object,T0=T0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.