R: Generate a Graph (or Stack) from a Given Blockmodel Using...

blockmodel.expand {sna} | R Documentation

## Generate a Graph (or Stack) from a Given Blockmodel Using Particular Expansion Rules

### Description

`blockmodel.expand` takes a blockmodel and an expansion vector, and expands the former by making copies of the vertices.

### Usage

    blockmodel.expand(b, ev, mode="digraph", diag=FALSE)

### Arguments

`b` | blockmodel object.
`ev` | a vector indicating the number of copies to make of each class (respectively).
`mode` | a string indicating whether the result should be a “graph” or “digraph”.
`diag` | a boolean indicating whether or not loops should be permitted.

### Details

The primary use of blockmodel expansion is in generating test data from a blockmodeling hypothesis. Expansion is performed depending on the content type of the blockmodel; at present, only density is supported. For the density content type, expansion is performed by interpreting the interclass density as an edge probability, and by drawing random graphs from the Bernoulli parameter matrix formed by expanding the density model. Thus, repeated calls to `blockmodel.expand` can be used to generate a sample for monte carlo null hypothesis tests under a Bernoulli graph model.

### Value

An adjacency matrix, or stack thereof.

### Note

Eventually, other content types will be supported.

### Author(s)

Carter T. Butts buttsc@uci.edu

### References

Doreian, P.; Batagelj, V.; and Ferligoj, A. (2005). Generalized Blockmodeling. Cambridge: Cambridge University Press.

White, H.C.; Boorman, S.A.; and Breiger, R.L. (1976). “Social Structure from Multiple Networks I: Blockmodels of Roles and Positions.” American Journal of Sociology, 81, 730-779.

### See Also

`blockmodel`

### Examples

    #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

    #Cluster based on structural equivalence
    eq<-equiv.clust(g)

    #Form a blockmodel with distance relaxation of 15
    b<-blockmodel(g,eq,h=15)

    #Draw from an expanded density blockmodel
    g.e<-blockmodel.expand(b,rep(2,length(b$rlabels)))  #Two of each class
    g.e

[Package sna version 2.5 Index]