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
|
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/games.R
\name{sample_smallworld}
\alias{sample_smallworld}
\alias{smallworld}
\alias{watts.strogatz.game}
\title{The Watts-Strogatz small-world model}
\usage{
sample_smallworld(dim, size, nei, p, loops = FALSE, multiple = FALSE)
smallworld(...)
}
\arguments{
\item{dim}{Integer constant, the dimension of the starting lattice.}
\item{size}{Integer constant, the size of the lattice along each dimension.}
\item{nei}{Integer constant, the neighborhood within which the vertices of
the lattice will be connected.}
\item{p}{Real constant between zero and one, the rewiring probability.}
\item{loops}{Logical scalar, whether loops edges are allowed in the
generated graph.}
\item{multiple}{Logical scalar, whether multiple edges are allowed int the
generated graph.}
\item{...}{Passed to \code{sample_smallworld}.}
}
\value{
A graph object.
}
\description{
Generate a graph according to the Watts-Strogatz network model.
}
\details{
First a lattice is created with the given \code{dim}, \code{size} and
\code{nei} arguments. Then the edges of the lattice are rewired uniformly
randomly with probability \code{p}.
Note that this function might create graphs with loops and/or multiple
edges. You can use \code{\link{simplify}} to get rid of these.
}
\examples{
g <- sample_smallworld(1, 100, 5, 0.05)
mean_distance(g)
transitivity(g, type="average")
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\references{
Duncan J Watts and Steven H Strogatz: Collective dynamics of
\sQuote{small world} networks, Nature 393, 440-442, 1998.
}
\seealso{
\code{\link{make_lattice}}, \code{\link{rewire}}
}
\keyword{graphs}
|