% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_traits_callaway}
\alias{sample_traits_callaway}
\alias{traits_callaway}
\alias{sample_traits}
\alias{traits}
\title{Graph generation based on different vertex types}
\usage{
sample_traits_callaway(
  nodes,
  types,
  edge.per.step = 1,
  type.dist = rep(1, types),
  pref.matrix = matrix(1, types, types),
  directed = FALSE
)

traits_callaway(
  nodes,
  types,
  edge.per.step = 1,
  type.dist = rep(1, types),
  pref.matrix = matrix(1, types, types),
  directed = FALSE
)

sample_traits(
  nodes,
  types,
  k = 1,
  type.dist = rep(1, types),
  pref.matrix = matrix(1, types, types),
  directed = FALSE
)

traits(
  nodes,
  types,
  k = 1,
  type.dist = rep(1, types),
  pref.matrix = matrix(1, types, types),
  directed = FALSE
)
}
\arguments{
\item{nodes}{The number of vertices in the graph.}

\item{types}{The number of different vertex types.}

\item{edge.per.step}{The number of edges to add to the graph per time step.}

\item{type.dist}{The distribution of the vertex types. This is assumed to be
stationary in time.}

\item{pref.matrix}{A matrix giving the preferences of the given vertex
types. These should be probabilities, i.e. numbers between zero and one.}

\item{directed}{Logical constant, whether to generate directed graphs.}

\item{k}{The number of trials per time step, see details below.}
}
\value{
A new graph object.
}
\description{
These functions implement evolving network models based on different vertex
types.
}
\details{
For \code{sample_traits_callaway()} the simulation goes like this: in each
discrete time step a new vertex is added to the graph. The type of this
vertex is generated based on \code{type.dist}. Then two vertices are
selected uniformly randomly from the graph. The probability that they will
be connected depends on the types of these vertices and is taken from
\code{pref.matrix}. Then another two vertices are selected and this is
repeated \code{edges.per.step} times in each time step.

For \code{sample_traits()} the simulation goes like this: a single vertex is
added at each time step. This new vertex tries to connect to \code{k}
vertices in the graph. The probability that such a connection is realized
depends on the types of the vertices involved and is taken from
\code{pref.matrix}.
}
\section{Related documentation in the C library}{
\href{https://igraph.org/c/html/0.10.17/igraph-Generators.html#igraph_callaway_traits_game}{\code{callaway_traits_game()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Generators.html#igraph_establishment_game}{\code{establishment_game()}}
}

\examples{

# two types of vertices, they like only themselves
g1 <- sample_traits_callaway(1000, 2, pref.matrix = matrix(c(1, 0, 0, 1), ncol = 2))
g2 <- sample_traits(1000, 2, k = 2, pref.matrix = matrix(c(1, 0, 0, 1), ncol = 2))
}
\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_grg}()},
\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_tree}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{games}
\keyword{graphs}
