R/graphs_regular.R

#' Create a regular graph adjacency matrix
#'
#' @param N The size of the graph.
#' @param k the number of neighbours of each node
#' @return an adjacency matrix of class simnetr_matrix
#' @examples
#' gr <- regular_matrix(1000,5)
#' @export
regular_matrix <- function(N, k) {
  stopifnot((N*k) %% 2 == 0)
  degree <- rep(k, N)
  network <- given_degree_matrix(N, degree)
}


#' Create a regular graph adjacency list
#'
#' @param N The size of the graph.
#' @param k the number of neighbours of each node
#' @return an adjacency matrix of class simnetr_list
#' @examples
#' gr <- regular_list(1000,5)
#' @export
regular_list <- function(N, k) {
  stopifnot((N*k) %% 2 == 0)
  degree <- rep(k, N)
  network <- given_degree_list(N, degree)
}
tjtnew/graphr documentation built on May 19, 2019, 9:38 p.m.