## generate a random tripartite network
set.seed(12)
Net <- build_toy_net(11,15,16,0.2)
data(PPH_Coltparkmeadow)
Net <- PPH_Coltparkmeadow
node_icc(Net)
set.seed(13)
library(igraph)
E(Net)$weight<-runif(length(E(Net)),0.1,1)#random weights assigned
node_icc(Net,weighted=TRUE)
##input as binary matrices,with row names.
set.seed(12)
md1 <- matrix(sample(c(0,1),5*8,replace=TRUE),5,8,
dimnames = list(paste0("b",1:5),paste0("c",1:8)))
md2 <- matrix(sample(c(0,1),20*30,replace=TRUE),20,30,
dimnames = list(paste0("b",1:20),paste0("a",1:30)))
node_icc(md1,md2)
##input as weighted matrices,with row numbers as row names.
set.seed(17)
mdw1 <- matrix(sample(c(rep(0,20),runif(20,0,1))),5,8)
mdw2 <- matrix(sample(c(rep(0,500),runif(100,0,1))),20,30)
node_icc(mdw1,mdw2)
node_icc(mdw1,mdw2,weighted=TRUE)
Run the code above in your browser using DataLab