R: Copy a network object enforcing ergm-appropriate guarantees...

standardize.network {ergm} | R Documentation

## 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)

### 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.

### Value

returns an ergm-appropriate network object.

### Note

This function may be time expensive. Also, the transformation is performed by deleting edges in initial network and re-adding them.

### Examples

    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

[Package ergm version 3.8.0 Index]