| mentor_matching {netdiffuseR} | R Documentation |
Optimal Leader/Mentor Matching
Description
Implementes the algorithm described in Valente and Davis (1999)
Usage
mentor_matching(
graph,
n,
cmode = "indegree",
lead.ties.method = "average",
geodist.args = list()
)
leader_matching(
graph,
n,
cmode = "indegree",
lead.ties.method = "average",
geodist.args = list()
)
## S3 method for class 'diffnet_mentor'
plot(
x,
y = NULL,
vertex.size = "degree",
minmax.relative.size = getOption("diffnet.minmax.relative.size", c(0.01, 0.04)),
lead.cols = grDevices::topo.colors(attr(x, "nleaders")),
vshapes = c(Leader = "square", Follower = "circle"),
add.legend = TRUE,
main = "Mentoring Network",
...
)
Arguments
graph |
Any class of accepted graph format (see |
n |
Number of leaders |
cmode |
Passed to |
lead.ties.method |
Passed to |
geodist.args |
Passed to |
x |
An object of class |
y |
Ignored. |
vertex.size |
Either a numeric scalar or vector of size |
minmax.relative.size |
Passed to |
lead.cols |
Character vector of length |
vshapes |
Character scalar of length 2. Shapes to identify leaders (mentors) and followers respectively. |
add.legend |
Logical scalar. When |
main |
Character scalar. Passed to |
... |
Further arguments passed to |
Details
The algorithm works as follows:
Find the top
nindividuals ranking them bydgr(graph, cmode). The rank is computed by the functionrank. Denote this setM.Compute the geodesic matrix.
For each
v in Vdo:Find the mentor
m in Msuch that is closest tovWere there a tie, choose the mentor that minimizes the average path length from
v's direct neighbors tom.If there are no paths to any member of
M, or all have the same average path length tov's neighbors, then assign one randomly.
Plotting is done via the function plot.igraph.
When vertex.size is either of "degree", "indegree", or
"outdegree", vertex.size will be replace with dgr(.,cmode = )
so that the vertex size reflects the desired degree.
The argument minmax.relative.size is passed to rescale_vertex_igraph
which adjusts vertex.size so that the largest and smallest vertices
have a relative size of minmax.relative.size[2] and
minmax.relative.size[1] respectively with respect to the x-axis.
Value
An object of class diffnet_mentor and data.frame with the following columns:
name |
Character. Labels of the vertices |
degree |
Numeric. Degree of each vertex in the graph |
iselader |
Logical. |
match |
Character. The corresponding matched leader. |
The object also contains the following attributes:
nleaders |
Integer scalar. The resulting number of leaders (could be greater than |
.
graph |
The original graph used to run the algorithm. |
References
Valente, T. W., & Davis, R. L. (1999). Accelerating the Diffusion of Innovations Using Opinion Leaders. The ANNALS of the American Academy of Political and Social Science, 566(1), 55–67. doi:10.1177/000271629956600105
Examples
# A simple example ----------------------------------------------------------
set.seed(1231)
graph <- rgraph_ws(n=50, k = 4, p = .5)
# Looking for 3 mentors
ans <- mentor_matching(graph, n = 3)
head(ans)
table(ans$match) # We actually got 9 b/c of ties
# Visualizing the mentor network
plot(ans)