View source: R/induced_submat.R
induced_submat | R Documentation |
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.
induced_submat(x, v, ...)
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. |
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.
A list of matrices as a result of the subsetting.
x <- rbernoulli(100)
induced_submat(x, c(1, 10, 30:50))
x <- rbernoulli(c(20, 20))
induced_submat(x, c(1:10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.