R/adja_gnp.R

Defines functions adja_gnp

Documented in adja_gnp

adja_gnp <- function(N, alpha, directed = FALSE) {

  gra <- igraph::sample_gnp(N, p = alpha * N^(-0.3), directed = directed, loops = FALSE)
  A <- igraph::as_adjacency_matrix(gra, sparse = FALSE) 
  w <- A / Rfast::rowsums(A)
  w[ is.na(w) ] <- 0
  w

}

Try the PNAR package in your browser

Any scripts or data that you put into this service are public.

PNAR documentation built on Sept. 12, 2024, 7:30 a.m.