R: Update the edges in a network based on a matrix

update.network {ergm} | R Documentation

## Update the edges in a network based on a matrix

### Description

Replaces the edges in a `network` object with the edges corresponding to the sociomatrix or edge list specified by `new`.

### Usage

    ## S3 method for class 'network'
    update(object, new, matrix.type = NULL,
      attrname = NULL, ..., ignore.nattr = c("bipartite", "directed",
      "hyper", "loops", "mnext", "multiple", "n"), ignore.vattr = c())

### Arguments

`object` | a `network` object.
`new` | Either an adjacency matrix (a matrix of values indicating the presence and/or the value of a tie from i to j) or an edge list (a two-column matrix listing origin and destination node numbers for each edge, with an optional third column for the value of the edge).
`matrix.type` | One of `"adjacency"` or `"edgelist"` telling which type of matrix `new` is. Default is to use the `which.matrix.type` function.
`attrname` | For a network with edge weights gives the name of the edge attribute whose names to set.
`...` | Additional arguments; currently unused.
`ignore.nattr` | Character vector of the names of network-level attributes to ignore when updating network objects (defaults to standard network properties).
`ignore.vattr` | Character vector of the names of vertex-level attributes to ignore when updating network objects.

### Value

A new `network` object with the edges specified by `new` and network and vertex attributes copied from the input network `object`. Input network is not modified.

### See Also

`ergm()`, `network`

### Examples

    #
    data(florentine)
    #
    # test the network.update function
    #
    # Create a Bernoulli network
    rand.net <- network(network.size(flomarriage))
    # store the sociomatrix
    rand.mat <- rand.net[,]
    # Update the network
    update(flomarriage, rand.mat, matrix.type="adjacency")
    # Try this with an edgelist
    rand.mat <- as.matrix.network.edgelist(flomarriage)[1:5,]
    update(flomarriage, rand.mat, matrix.type="edgelist")

[Package ergm version 3.10.4 Index]