# Create a network with groups
adj <- matrix(0, 9, 9)
adj[1, 2:3] <- 1; adj[2:3, 1] <- 1 # Group 1
adj[4, 5:6] <- 1; adj[5:6, 4] <- 1 # Group 2
adj[7, 8:9] <- 1; adj[8:9, 7] <- 1 # Group 3
net <- CographNetwork$new(adj)
groups <- c(1, 1, 1, 2, 2, 2, 3, 3, 3)
coords <- layout_groups(net, groups)
Run the code above in your browser using DataLab