networkLite {tergmLite}R Documentation

networkLite Constructor Utilities

Description

Constructor methods for networkLite objects.

Usage

networkLite(x, ...)

## S3 method for class 'numeric'
networkLite(
  x,
  directed = FALSE,
  bipartite = FALSE,
  loops = FALSE,
  hyper = FALSE,
  multiple = FALSE,
  ...
)

## S3 method for class 'edgelist'
networkLite(x, attr = list(), ...)

## S3 method for class 'matrix'
networkLite(x, attr = list(), ...)

Arguments

x

either an edgelist class network representation (including network attributes in its attributes list), or a number specifying the network size.

...

additional arguments used by other methods.

directed, bipartite, loops, hyper, multiple

common network attributes that may be set via arguments to the networkLite.numeric method.

attr

a named list of vertex attributes for the network represented by x.

Details

Currently there are two distinct networkLite constructor methods available.

The edgelist method takes an edgelist class object x with network attributes attached in its attributes list, and a named list of vertex attributes attr, and returns a networkLite object, which is a named list with fields el, attr, and gal; the fields el and attr match the arguments x and attr respectively, and the field gal is the list of network attributes (copied from attributes(x)). Missing attributes directed, bipartite, loops, hyper, and multiple are defaulted to FALSE; the network size attribute n must not be missing. Attributes class, dim, and vnames (if present) are not copied from x to the networkLite. (For convenience, a matrix method, identical to the edgelist method, is also defined, to handle cases where the edgelist is, for whatever reason, not classed as an edgelist.)

The numeric method takes a number x as well as the network attributes directed, bipartite, loops, hyper, and multiple (defaulting to FALSE), and returns an empty networkLite with these network attributes and number of nodes x.

Within tergmLite, the networkLite data structure is used in the calls to ergm and tergm simulate functions.

Value

A networkLite object with edge list el, vertex attributes attr, and network attributes gal.

Examples

## Not run: 
library("EpiModel")
nw <- network_initialize(100)
formation <- ~edges
target.stats <- 50
coef.diss <- dissolution_coefs(dissolution = ~offset(edges), duration = 20)
x <- netest(nw, formation, target.stats, coef.diss, verbose = FALSE)

param <- param.net(inf.prob = 0.3)
init <- init.net(i.num = 10)
control <- control.net(type = "SI", nsteps = 100, nsims = 5, tergmLite = TRUE)

# networkLite representation after initialization
dat <- crosscheck.net(x, param, init, control)
dat <- initialize.net(x, param, init, control)

# Conversion to networkLite class format
nwl <- networkLite(dat$el[[1]], dat$attr)
nwl

## End(Not run)


[Package tergmLite version 2.6.1 Index]