File: sample_traits_callaway.Rd

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (73 lines) | stat: -rw-r--r-- 2,530 bytes parent folder | download | duplicates (2)
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
62
63
64
65
66
67
68
69
70
71
72
73
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/games.R
\name{sample_traits_callaway}
\alias{callaway.traits.game}
\alias{establishment.game}
\alias{sample_traits}
\alias{sample_traits_callaway}
\alias{traits}
\alias{traits_callaway}
\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(...)

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

traits(...)
}
\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, ie. numbers between zero and one.}

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

\item{...}{Passed to the constructor, \code{sample_traits} or
\code{sample_traits_callaway}.}

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