R/randadj.R

Defines functions randomadj

randomadj <- function(n, prob){
  B <- matrix(0,n,n)
  for(i in 2:n){
    for(j in 1:(i-1)){
    r <- runif(1,0,1)
    if(r < prob){
      B[i,j] <- 1
      B[j,i] <- 1
    }
    }
  }
}

Try the sdpt3r package in your browser

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

sdpt3r documentation built on May 2, 2019, 4:19 a.m.