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