File: sample_traits_callaway.Rd

package info (click to toggle)
r-cran-igraph 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,044 kB
  • sloc: ansic: 204,981; cpp: 21,711; fortran: 4,090; yacc: 1,229; lex: 519; sh: 52; makefile: 8
file content (112 lines) | stat: -rw-r--r-- 3,385 bytes parent folder | download
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
% 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(...)

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, i.e. 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), 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{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}