# expected_edges: Calculate the expected edges in Poisson RDPG graph In fastRG: Sample Generalized Random Dot Product Graphs in Linear Time

## Description

These calculations are conditional on the latent factors `X` and `Y`.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```expected_edges(factor_model, ...) expected_degree(factor_model, ...) expected_in_degree(factor_model, ...) expected_out_degree(factor_model, ...) expected_density(factor_model, ...) expected_degrees(factor_model, ...) ```

## Arguments

 `factor_model` A `directed_factor_model()` or `undirected_factor_model()`. `...` Ignored. Do not use.

## Details

Note that the runtime of the `fastRG` algorithm is proportional to the expected number of edges in the graph. Expected edge count will be an underestimate of expected number of edges for Bernoulli graphs. See the Rohe et al for details.

## Value

Expected edge counts, or graph densities.

## References

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

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29``` ```n <- 10000 k <- 5 X <- matrix(rpois(n = n * k, 1), nrow = n) S <- matrix(runif(n = k * k, 0, .1), nrow = k) ufm <- undirected_factor_model(X, S) expected_edges(ufm) expected_degree(ufm) eigs_sym(ufm) n <- 10000 d <- 1000 k1 <- 5 k2 <- 3 X <- matrix(rpois(n = n * k1, 1), nrow = n) Y <- matrix(rpois(n = d * k2, 1), nrow = d) S <- matrix(runif(n = k1 * k2, 0, .1), nrow = k1) dfm <- directed_factor_model(X = X, S = S, Y = Y) expected_edges(dfm) expected_in_degree(dfm) expected_out_degree(dfm) svds(dfm) ```

fastRG documentation built on Feb. 26, 2021, 5:10 p.m.