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
|
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/games.R
\name{sample_gnp}
\alias{gnp}
\alias{sample_gnp}
\title{Generate random graphs according to the G(n,p) Erdos-Renyi model}
\usage{
sample_gnp(n, p, directed = FALSE, loops = FALSE)
gnp(...)
}
\arguments{
\item{n}{The number of vertices in the graph.}
\item{p}{The probability for drawing an edge between two
arbitrary vertices (G(n,p) graph).}
\item{directed}{Logical, whether the graph will be directed, defaults to
FALSE.}
\item{loops}{Logical, whether to add loop edges, defaults to FALSE.}
\item{...}{Passed to \code{sample_app}.}
}
\value{
A graph object.
}
\description{
This model is very simple, every possible edge is created with the same
constant probability.
}
\details{
The graph has \sQuote{n} vertices and for each edge the
probability that it is present in the graph is \sQuote{p}.
}
\examples{
g <- sample_gnp(1000, 1/1000)
degree_distribution(g)
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\references{
Erdos, P. and Renyi, A., On random graphs, \emph{Publicationes
Mathematicae} 6, 290--297 (1959).
}
\seealso{
\code{\link{sample_gnm}}, \code{\link{sample_pa}}
}
\keyword{graphs}
|