Learn R Programming

ergm (version 3.9.4)

standardize.network: Copy a network object enforcing ergm-appropriate guarantees about its internal representation

Description

Create a copy of a network of interest with certain guarantees about its internal representation:

  • for every edge, the id of the 'tails' vertex is < id of the 'heads' vertex if the network is undirected

  • no (tail,head) id pair has more than one edge ID associated with it (no multiplex edges)

Usage

standardize.network(nw, preserve.eattr = TRUE)

Arguments

nw

a network object to be copied

preserve.eattr

logical; should the edge attributes be preserved during the copying process (presumably slower)

Value

returns an ergm-appropriate network object.

Details

This function is needed because the network object can support added non-directed edges in arbitrary order, as well as multiplex edges and hypergraphs (even if the network is not marked as such), which are not supported in the underlying ergm processes. Uses as.edgelist internally to make the conversion.

Examples

Run this code
# NOT RUN {
test<-network.initialize(5,directed=FALSE)
test[2,1]<-1  #ergm wont like this
test$mel[[1]] # peek at internal representation

test2<-standardize.network(test) # enforce!
test2$mel[[2]]  # 1 and 2 have traded places


# }

Run the code above in your browser using DataLab