sbn_to_mtx {SBN} | R Documentation |
Convert network to various adjacency/distance matrix formats
Description
Convert a downstream directed SBN to various adjacency or distance matrix formats.
Usage
sbn_to_mtx(
g,
method = c("dwn_mtx", "undir_mtx", "up_mtx", "n2n_dist_up", "n2n_dist_dwn",
"n2n_dist_undir"),
unconnected = Inf,
weights = NULL
)
Arguments
g |
a river network as an igraph object. Must be a downstream directed graph. |
method |
one of "dwn_mtx", an adjacency matrix for a downstream directed SBN, "up_mtx", an adjacency matrix for a upstream directed SBN, "undir_mtx", an adjacency matrix for a undirected SBN, "n2n_dist_up", "n2n_dist_dwn" or "n2n_dist_undir", an adjacency matrix of upstream, downstream or undirected node to node distances. |
unconnected |
when generating node-to-node distance matrices, what value should be used for unconnected elements. For example, in a downstream directed network, all upstream links are considered unconnected. Default value is |
weights |
passed to |
Value
An adjacency or distance matrix.
Examples
g <- sbn_create(10, 0.7)
sbn_to_mtx(g, method = "dwn_mtx")