induced_submat {ergmito} | R Documentation |
Extract a submatrix from a network
Description
This is similar to network::get.inducedSubgraph. The main difference is that the resulting object will always be a list of matrices, and it is vectorized.
Usage
induced_submat(x, v, ...)
Arguments
x |
Either a list or single matrices or network objects. |
v |
Either a list or a single integer vector of vertices to subset. |
... |
Currently ignored. |
Details
Depending on the lengths of x
and v
, the function can take the
following strategies:
If both are of the same size, then it will match the networks and the vector of indices.
If
length(x) == 1
, then it will use that single network as a baseline for generating the subgraphs.If
length(v) == 1
, then it will generate the subgraph using the same set of vertices for each network.If both have more than one element, but different sizes, then the function returns with an error.
Value
A list of matrices as a result of the subsetting.
Examples
x <- rbernoulli(100)
induced_submat(x, c(1, 10, 30:50))
x <- rbernoulli(c(20, 20))
induced_submat(x, c(1:10))