## generate a random tripartite network
set.seed(12)
Net <- build_toy_net(11,15,16,0.2)
icmotif_count(Net)
## empirical network
data(PPH_Coltparkmeadow)
Net <- PPH_Coltparkmeadow
icmotif_count(Net)
set.seed(13)
library(igraph)
E(Net)$weight<-runif(length(E(Net)),0.1,1)#random weights assigned
icmotif_count(Net, weighted=TRUE)
##input as binary matrices, with row names.
set.seed(12)
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))
icmotif_count(md1,md2)
##input as weighted matrices,with row numbers as row names.
set.seed(12)
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)
icmotif_count(mdw1,mdw2,weighted=TRUE)
Run the code above in your browser using DataLab