n<-20
net<-matrix(NA,ncol=n,nrow=n)
clu<-rep(1:2,times=c(5,15))
tclu<-table(clu)
net[clu==1,clu==1]<-0
net[clu==1,clu==2]<-rnorm(n=tclu[1]*tclu[2],
mean=4,sd=1)*sample(c(0,1),
size= tclu[1]*tclu[2],replace=TRUE,prob=c(3/5,2/5))
net[clu==2,clu==1]<-0
net[clu==2,clu==2]<-0
D<-REGE.for(M=net)$E #any other REGE function can be used
plot.mat(net, clu=cutree(hclust(d=as.dist(1-D),method="ward"),
k=2))
#REGE returns similarities, which have to be converted to
#disimilarities
res<-opt.random.par(M=net,k=2,rep=10,approach="ss",blocks="reg",
FUN="max")
plot(res) #Hopefully we get the original partitionRun the code above in your browser using DataLab