# NOT RUN {
#A weighted binary bipartite network of 20 agents & 50 artifacts; agents form two communities
B <- rbind(cbind(matrix(sample(0:3, 250, replace = TRUE, prob = ((1:4)^2)),10),
matrix(sample(0:3, 250, replace = TRUE, prob = ((4:1)^2)),10)),
cbind(matrix(sample(0:3, 250, replace = TRUE, prob = ((4:1)^2)),10),
matrix(sample(0:3, 250, replace = TRUE, prob = ((1:4)^2)),10)))
P <- B%*%t(B) #An ordinary weighted projection...
plot(igraph::graph_from_adjacency_matrix(P, mode = "undirected",
weighted = TRUE, diag = FALSE)) #...is a dense hairball
bb <- osdsm(B, alpha = 0.05, narrative = TRUE, class = "igraph") #An oSDSM backbone...
plot(bb) #...is sparse with clear communities
# }
Run the code above in your browser using DataLab