Hi, > Could someone please give me an idea how to convert the vector 'memb' into community object 'comm'?
make_clusters(graph, membership) seems to do the trick. T. On Fri, Apr 1, 2016 at 3:50 AM, MikeS <[email protected]> wrote: > 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). > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
