## generate a random binary tripartite network
set.seed(12)
Net <- build_toy_net(11,15,16,0.2)
hc(Net)
#empirical network
data(PPH_Coltparkmeadow)
Net <- PPH_Coltparkmeadow
hc(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.
set.seed(12)
md1 <- matrix(sample(c(0,1),5*8,replace=TRUE),5,8)
dimnames(md1) = list(paste0("b",1:5),paste0("c",1:8))
md2 <- matrix(sample(c(0,1),20*30,replace=TRUE),20,30)
dimnames(md2) = list(paste0("b",1:20),paste0("a",1:30))
hc(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)
hc(mdw1,mdw2)
hc(mdw1,mdw2,weighted=TRUE)
Run the code above in your browser using DataLab