#Draw a random graph
g<-rgraph(10,tp=2/9)
#Show the total partial out-neighborhoods
neigh<-neighborhood(g,9,neighborhood.type="out",return.all=TRUE)
par(mfrow=c(3,3))
for(i in 1:9)
gplot(neigh[i,,],main=paste("Partial Neighborhood of Order",i))
#Show the total cumulative out-neighborhoods
neigh<-neighborhood(g,9,neighborhood.type="out",return.all=TRUE,
partial=FALSE)
par(mfrow=c(3,3))
for(i in 1:9)
gplot(neigh[i,,],main=paste("Cumulative Neighborhood of Order",i))
Run the code above in your browser using DataLab