# preference.game

##### Trait-based random generation

Generation of random graphs based on different vertex types.

- Keywords
- graphs

##### Usage

```
preference.game(nodes, types, type.dist=rep(1, types), fixed.sizes=FALSE,
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)
```

##### Arguments

- nodes
- The number of vertices in the graphs.
- types
- The number of different vertex types.
- type.dist
- The distribution of the vertex types, a numeric
vector of length
types containing non-negative numbers. The vector will be normed to obtain probabilities. - fixed.sizes
- Fix the number of vertices with a given
vertex type label. The
`type.dist`

argument gives the group sizes (i.e. number of vertices with the different labels) in this case. - type.dist.matrix
- The joint distribution of the in- and out-vertex types.
- pref.matrix
- A square matrix giving the preferences of the
vertex types. The matrix has
types rows and columns. - directed
- Logical constant, whether to create a directed graph.
- loops
- Logical constant, whether self-loops are allowed in the graph.

##### Details

Both models generate random graphs with given vertex types. For
`preference.game`

the probability that two vertices will be
connected depends on their type and is given by the

For `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

##### Value

- An igraph graph.

##### See Also

##### Examples

```
pf <- matrix( c(1, 0, 0, 1), nr=2)
g <- preference.game(20, 2, pref.matrix=pf)
tkplot(g, layout=layout.fruchterman.reingold)
pf <- matrix( c(0, 1, 0, 0), nr=2)
g <- asymmetric.preference.game(20, 2, pref.matrix=pf)
tkplot(g, layout=layout.circle)
```

*Documentation reproduced from package igraph, version 0.6.5-2, License: GPL (>= 2)*