networkLite {networkLite} | R Documentation |
networkLite Constructor Utilities
Description
Constructor methods for networkLite
objects.
Usage
networkLite(x, ...)
## S3 method for class 'edgelist'
networkLite(
x,
attr = list(vertex.names = seq_len(net_attr[["n"]]), na = logical(net_attr[["n"]])),
net_attr = attributes(x)[setdiff(names(attributes(x)), c("class", "dim", "dimnames",
"vnames", "row.names", "names", "mnext"))],
...,
atomize = FALSE
)
## S3 method for class 'matrix'
networkLite(
x,
attr = list(vertex.names = seq_len(net_attr[["n"]]), na = logical(net_attr[["n"]])),
net_attr = attributes(x)[setdiff(names(attributes(x)), c("class", "dim", "dimnames",
"vnames", "row.names", "names", "mnext"))],
...,
atomize = FALSE
)
## S3 method for class 'numeric'
networkLite(x, directed = FALSE, bipartite = FALSE, ...)
networkLite_initialize(x, directed = FALSE, bipartite = FALSE, ...)
Arguments
x |
Either an |
... |
additional arguments |
attr |
A named list of vertex attributes, coerced to |
net_attr |
A named list of network attributes. Must include the network
size attribute named |
atomize |
Logical; should we call |
directed , bipartite |
Common network attributes that may be set via
arguments to the |
Details
Currently there are several distinct networkLite
constructor
methods available.
The edgelist
method takes an edgelist
class object x
, a named
list of vertex attributes attr
, and a named list of network attributes
net_attr
, and returns a networkLite
object, which is a named list with
fields el
, attr
, and gal
, corresponding to the arguments x
, attr
,
and net_attr
. Missing network attributes directed
and bipartite
are
defaulted to FALSE
; the network size attribute n
must not be missing.
The numeric
method takes a number x
as well as the network
attributes directed
and bipartite
(defaulting to FALSE
),
and returns an empty networkLite
with these network attributes and
number of nodes x
.
The constructor networkLite_initialize
is also available for creating
an empty networkLite
, and its x
argument should be a number
indicating the size of the networkLite
to create.
Within EpiModel
, the networkLite
data structure is used in the
calls to ergm
and tergm
simulate
and summary
functions.
Value
A networkLite
object constructed according to the inputs.
Examples
edgelist <- cbind(c(1, 2, 3), c(2, 4, 7))
attr(edgelist, "n") <- 10 # network size
vertex_attributes <- list(a = 1:10, b = runif(10))
nwL <- networkLite(edgelist, vertex_attributes)
nwL