% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_grg}
\alias{sample_grg}
\alias{grg}
\title{Geometric random graphs}
\usage{
sample_grg(nodes, radius, torus = FALSE, coords = FALSE)

grg(nodes, radius, torus = FALSE, coords = FALSE)
}
\arguments{
\item{nodes}{The number of vertices in the graph.}

\item{radius}{The radius within which the vertices will be connected by an
edge.}

\item{torus}{Logical constant, whether to use a torus instead of a square.}

\item{coords}{Logical scalar, whether to add the positions of the vertices
as vertex attributes called \sQuote{\code{x}} and \sQuote{\code{y}}.}
}
\value{
A graph object. If \code{coords} is \code{TRUE} then with vertex
attributes \sQuote{\code{x}} and \sQuote{\code{y}}.
}
\description{
Generate a random graph based on the distance of random point on a unit
square
}
\details{
First a number of points are dropped on a unit square, these points
correspond to the vertices of the graph to create. Two points will be
connected with an undirected edge if they are closer to each other in
Euclidean norm than a given radius. If the \code{torus} argument is
\code{TRUE} then a unit area torus is used instead of a square.
}
\section{Related documentation in the C library}{
\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}
}

\examples{

g <- sample_grg(1000, 0.05, torus = FALSE)
g2 <- sample_grg(1000, 0.05, torus = TRUE)

}
\seealso{
Random graph models (games)
\code{\link{bipartite_gnm}()},
\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_growing}()},
\code{\link{sample_hierarchical_sbm}()},
\code{\link{sample_islands}()},
\code{\link{sample_k_regular}()},
\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{
Gabor Csardi \email{csardi.gabor@gmail.com}, first version was
written by Keith Briggs (\url{https://keithbriggs.info/}).
}
\concept{games}
\keyword{graphs}
