View source: R/sample_edgelist.R
sample_edgelist.matrix | R Documentation |
This is a breaks-off, no safety checks interface.
We strongly recommend that you do not call
sample_edgelist.matrix()
unless you know what you are doing,
and even then, we still do not recommend it, as you will
bypass all typical input validation.
extremely loud coughing All those who bypass input
validation suffer foolishly at their own hand.
extremely loud coughing
## S3 method for class 'matrix'
sample_edgelist(
factor_model,
S,
Y,
directed,
poisson_edges,
allow_self_loops,
...
)
## S3 method for class 'Matrix'
sample_edgelist(
factor_model,
S,
Y,
directed,
poisson_edges,
allow_self_loops,
...
)
factor_model |
An |
S |
A |
Y |
A |
directed |
Logical indicating whether or not the graph should be
directed. When |
poisson_edges |
Whether or not to remove duplicate edges
after sampling. See Section 2.3 of Rohe et al. (2017)
for some additional details. Defaults to |
allow_self_loops |
Logical indicating whether or not
nodes should be allowed to form edges with themselves.
Defaults to |
... |
Ignored, for generic consistency only. |
This function implements the fastRG
algorithm as
described in Rohe et al (2017). Please see the paper
(which is short and open access!!) for details.
A single realization of a random Poisson (or Bernoulli)
Dot Product Graph, represented as a tibble::tibble()
with two
integer columns, from
and to
.
NOTE: Indices for isolated nodes will not appear in the edgelist! This can lead to issues if you construct network objects from the edgelist directly.
In the undirected case, from
and to
do not encode
information about edge direction, but we will always have
from <= to
for convenience of edge identification.
To avoid handling such considerations yourself, we recommend using
sample_sparse()
, sample_igraph()
, and sample_tidygraph()
over sample_edgelist()
.
Rohe, Karl, Jun Tao, Xintian Han, and Norbert Binkiewicz. 2017. "A Note on Quickly Sampling a Sparse Matrix with Low Rank Expectation." Journal of Machine Learning Research; 19(77):1-13, 2018. https://www.jmlr.org/papers/v19/17-128.html
Other samplers:
sample_edgelist()
,
sample_igraph()
,
sample_sparse()
,
sample_tidygraph()
set.seed(46)
n <- 10000
d <- 1000
k1 <- 5
k2 <- 3
X <- matrix(rpois(n = n * k1, 1), nrow = n)
S <- matrix(runif(n = k1 * k2, 0, .1), nrow = k1)
Y <- matrix(rpois(n = d * k2, 1), nrow = d)
sample_edgelist(X, S, Y, TRUE, TRUE, TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.