Utility functions to query network dimensions
nvertex(x) nedges(x, ...) nnets(x) is_directed(x, check_type = FALSE)
x | Either an object of class ergmito, network, formula, or matrix. |
---|---|
... | Further arguments passed to the method. Currently only |
check_type | Logical scalar. When checking for whether the network is directed or not, we can ask the function to return with an error if what we are checking is not an object of class network, otherwise it simply returns false. |
is_directed
checks whether the passed networks are directed using
the function is.directed
. In the case of multiple networks,
the function returns a logical vector. Only objects of class network
can be
checked, otherwise, if check_type = FALSE
, the function returns TRUE
by default.
set.seed(771) net <- lapply(rbernoulli(c(4, 4)), network::network, directed = FALSE) is_directed(net)#> [1] FALSE FALSEis_directed(net[[1]])#> [1] FALSEis_directed(net ~ edges)#> [1] FALSE FALSEif (FALSE) { is_directed(net[[1]][1:4, 1:4], check_type = TRUE) # Error } is_directed(net[[1]][1:4, 1:4])#> [1] TRUE