\HeaderA{traits}{Graph generation based on different vertex types}{traits}
\aliasA{callaway.traits.game}{traits}{callaway.traits.game}
\aliasA{establishment.game}{traits}{establishment.game}
\keyword{graphs}{traits}
\begin{Description}\relax
These functions implement evolving network models based on
different vertex types.
\end{Description}
\begin{Usage}
\begin{verbatim}
callaway.traits.game (nodes, types, edge.per.step = 1, type.dist = rep(1, 
    types), pref.matrix = matrix(1, types, types), directed = FALSE) 
establishment.game(nodes, types, k = 1, type.dist = rep(1, types),
    pref.matrix = matrix(1, types, types), directed = FALSE) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{nodes}] The number of vertices in the graph.
\item[\code{types}] The number of different vertex types.
\item[\code{edge.per.step}] The number of edges to add to the graph per time step.
\item[\code{type.dist}] The distribution of the vertex types. This is assumed
to be stationary in time.
\item[\code{pref.matrix}] A matrix giving the preferences of the given vertex
types. These should be probabilities, ie. numbers between zero and
one.
\item[\code{directed}] Logical constant, whether to generate directed
graphs.
\item[\code{k}] The number of trials per time step, see details below.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For \code{callaway.traits.game} 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{establishment.game} 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}.
\end{Details}
\begin{Value}
A new graph object.
\end{Value}
\begin{Author}\relax
Gabor Csardi \email{csardi@rmki.kfki.hu}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
# two types of vertices, they like only themselves
g1 <- callaway.traits.game(1000, 2, pref.matrix=matrix( c(1,0,0,1), nc=2))
g2 <- establishment.game(1000, 2, k=2, pref.matrix=matrix( c(1,0,0,1), nc=2))
\end{ExampleCode}
\end{Examples}

