Utility functions to query network dimensions

nvertex(x)

nedges(x, ...)

nnets(x)

is_directed(x, check_type = FALSE)

Arguments

x

Either an object of class ergmito, network, formula, or matrix.

...

Further arguments passed to the method. Currently only nedges.network receives arguments (see network::network.edgecount).

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.

Value

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.

Examples

set.seed(771) net <- lapply(rbernoulli(c(4, 4)), network::network, directed = FALSE) is_directed(net)
#> [1] FALSE FALSE
is_directed(net[[1]])
#> [1] FALSE
is_directed(net ~ edges)
#> [1] FALSE FALSE
if (FALSE) { is_directed(net[[1]][1:4, 1:4], check_type = TRUE) # Error } is_directed(net[[1]][1:4, 1:4])
#> [1] TRUE