#Create a random graph with _some_ edge structure
g.p<-sapply(runif(20,0,1),rep,20) #Create a matrix of edge
#probabilities
g<-rgraph(20,tprob=g.p) #Draw from a Bernoulli graph
#distribution
#Get RE distances
g.re<-redist(g)
#Plot a metric MDS of vertex positions in two dimensions
plot(cmdscale(as.dist(g.re)))
#What if there were already something known to be different about
#the first five vertices?
sp<-rep(1:2,times=c(5,15)) #Create "seed" partition
g.spre<-redist(g,seed.partition=sp) #Get new RE distances
g.spre
plot.sociomatrix(g.spre) #Note the blocking!
Run the code above in your browser using DataLab