[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Community detection based on conductance
From: |
MikeS |
Subject: |
Re: [igraph] Community detection based on conductance |
Date: |
Fri, 1 Apr 2016 08:50:31 +0700 |
Hello,
I would like to compare two partitioning network metric -- modularity
and conductance -- step by step. Example code is shown below. Maximum
modularity equal to
> max(m)
[1] 0.4583333
library(igraph)
g <- make_graph( ~ A-B-C-D-A, E-A:B:C:D,
F-G-H-I-F, J-F:G:H:I,
K-L-M-N-K, O-K:L:M:N,
P-Q-R-S-P, T-P:Q:R:S,
B-F, E-J, C-I, L-T, O-T, M-S,
C-P, C-L, I-L, I-P)
gnc <- walktrap.community(g)
m <- vector()
con <- vector()
for (s in 0: nrow(gnc$merges)) {
memb <- cutat(gnc, steps=s)
m <- c(m, modularity (g, memb, weights=NULL))
intra<-0 # edge connects two nodes inside community
extra<-0 # edge connects two different communities
for(i in 1:length(E(g))) {
# ifelse(crossing(comm, g)[i]==FALSE, intra<- intra+1, extra<- extra+1)
}
# con <-c(con, intra/extra)
}
Could someone please give me an idea how to convert the vector 'memb'
into community object 'comm'? Unfortunately, I don’t know how to pass
the first argument to the crossing('comm', g).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [igraph] Community detection based on conductance,
MikeS <=