Replaces the edges in a network object with the edges corresponding to the sociomatrix specified by
newmatrix
.
See ergm
for more information.
network.update(nw, newmatrix, matrix.type=NULL, output="network",
ignore.nattr = c("bipartite", "directed", "hyper",
"loops", "mnext", "multiple", "n"), ignore.vattr = c())
Either an adjacency matrix (a matrix of zeros and ones indicating the presence of a tie from i to j) or an edgelist (a two-column matrix listing origin and destination node numbers for each edge; note that in an undirected matrix, the first column should be the smaller of the two numbers).
One of "adjacency" or "edgelist" telling which type of
matrix newmatrix
is. Default is to use the
which.matrix.type
function.
Currently unused.
character vector of the names of network-level attributes to ignore when updating network objects (defaults to standard network properties)
character vector of the names of vertex-level attributes to ignore when updating network objects
network.update
returns a new network
object with the edges specified by newmatrix
and network and vertex attributes copied from the input network nw
. Input network is not modified.
ergm, network
# NOT RUN {
#
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
network.update(flomarriage, rand.mat, matrix.type="adjacency")
# Try this with an edgelist
rand.mat <- as.matrix.network.edgelist(flomarriage)[1:5,]
network.update(flomarriage, rand.mat, matrix.type="edgelist")
# }
Run the code above in your browser using DataLab