\HeaderA{preference.game}{Trait-based random generation}{preference.game}
\aliasA{asymmetric.preference.game}{preference.game}{asymmetric.preference.game}
\keyword{graphs}{preference.game}
\begin{Description}\relax
Generation of random graphs based on different vertex types.
\end{Description}
\begin{Usage}
\begin{verbatim}
preference.game(nodes, types, type.dist=rep(1, types),
    pref.matrix=matrix(1, types, types), directed=FALSE, loops=FALSE) 
asymmetric.preference.game(nodes, types,
    type.dist.matrix=matrix(1,types,types),
    pref.matrix = matrix(1, types, types), loops=FALSE) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{nodes}] The number of vertices in the graphs.
\item[\code{types}] The number of different vertex types.
\item[\code{type.dist}] The distribution of the vertex types, a numeric
vector of length \sQuote{types} containing non-negative numbers. The
vector will be normed to obtain probabilities.
\item[\code{type.dist.matrix}] The joint distribution of the in- and
out-vertex types.
\item[\code{pref.matrix}] A square matrix giving the preferences of the
vertex types. The matrix has \sQuote{types} rows and columns.
\item[\code{directed}] Logical constant, whether to create a directed graph.
\item[\code{loops}] Logical constant, whether self-loops are allowed in the
graph.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Both models generate random graphs with given vertex types. For
\code{preference.game} the probability that two vertices will be
connected depends on their type and is given by the
\sQuote{pref.matrix} argument. This matrix should be symmetric to make
sense but this is not checked. The distribution of the different
vertes types is given by the \sQuote{type.dist} vector.

For \code{asymmetric.preference.game} each vertex has an in-type and
an out-type and a directed graph is created. The probability that a
directed edge is realized from a vertex with a given out-type to a
vertex with a given in-type is given in the \sQuote{pref.matrix}
argument, which can be asymmetric. The joint distribution for the in-
and out-types is given in the \sQuote{type.dist.matrix} argument.
\end{Details}
\begin{Author}\relax
Tamas Nepusz \email{ntamas@rmki.kfki.hu} and Gabor Csardi
\email{csardi@rmki.kfki.hu} for the R interface
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{establishment.game}{establishment.game}}.
\code{\LinkA{callaway.traits.game}{callaway.traits.game}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
pf <- matrix( c(1, 0, 0, 1), nr=2)
g <- preference.game(20, 2, pref.matrix=pf)
## Not run: tkplot(g, layout=layout.fruchterman.reingold)

pf <- matrix( c(0, 1, 0, 0), nr=2)
g <- asymmetric.preference.game(20, 2, pref.matrix=pf)
## Not run: tkplot(g, layout=layout.circle)
\end{ExampleCode}
\end{Examples}

