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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_k_regular}
\alias{sample_k_regular}
\title{Create a random regular graph}
\usage{
sample_k_regular(no.of.nodes, k, directed = FALSE, multiple = FALSE)
}
\arguments{
\item{no.of.nodes}{Integer scalar, the number of vertices in the generated
graph.}
\item{k}{Integer scalar, the degree of each vertex in the graph, or the
out-degree and in-degree in a directed graph.}
\item{directed}{Logical scalar, whether to create a directed graph.}
\item{multiple}{Logical scalar, whether multiple edges are allowed.}
}
\value{
An igraph graph.
}
\description{
Generate a random graph where each vertex has the same degree.
}
\details{
This game generates a directed or undirected random graph where the degrees
of vertices are equal to a predefined constant k. For undirected graphs, at
least one of k and the number of vertices must be even.
The game simply uses \code{\link[=sample_degseq]{sample_degseq()}} with appropriately
constructed degree sequences.
}
\examples{
## A simple ring
ring <- sample_k_regular(10, 2)
plot(ring)
## k-regular graphs on 10 vertices, with k=1:9
k10 <- lapply(1:9, sample_k_regular, no.of.nodes = 10)
layout(matrix(1:9, nrow = 3, byrow = TRUE))
sapply(k10, plot, vertex.label = NA)
}
\seealso{
\code{\link[=sample_degseq]{sample_degseq()}} for a generator with prescribed degree
sequence.
Random graph models (games)
\code{\link{erdos.renyi.game}()},
\code{\link{sample_}()},
\code{\link{sample_bipartite}()},
\code{\link{sample_chung_lu}()},
\code{\link{sample_correlated_gnp}()},
\code{\link{sample_correlated_gnp_pair}()},
\code{\link{sample_degseq}()},
\code{\link{sample_dot_product}()},
\code{\link{sample_fitness}()},
\code{\link{sample_fitness_pl}()},
\code{\link{sample_forestfire}()},
\code{\link{sample_gnm}()},
\code{\link{sample_gnp}()},
\code{\link{sample_grg}()},
\code{\link{sample_growing}()},
\code{\link{sample_hierarchical_sbm}()},
\code{\link{sample_islands}()},
\code{\link{sample_last_cit}()},
\code{\link{sample_pa}()},
\code{\link{sample_pa_age}()},
\code{\link{sample_pref}()},
\code{\link{sample_sbm}()},
\code{\link{sample_smallworld}()},
\code{\link{sample_traits_callaway}()},
\code{\link{sample_tree}()}
}
\author{
Tamas Nepusz \email{ntamas@gmail.com}
}
\concept{games}
\keyword{graphs}
\section{Related documentation in the C library}{\href{https://igraph.org/c/html/latest/igraph-Generators.html#igraph_k_regular_game}{\code{igraph_k_regular_game()}}.}
|