Package 'keyplayer'

Title: Locating Key Players in Social Networks
Description: Computes group centrality scores and identifies the most central group of players in a network.
Authors: Weihua An; Yu-Hsin Liu
Maintainer: Weihua An <[email protected]>
License: GPL (>= 3)
Version: 1.0.4
Built: 2024-11-03 03:19:16 UTC
Source: https://github.com/cran/keyplayer

Help Index


Group the Chosen Players in a Network

Description

contract combines selected nodes into one large pseudo-node and provides a reduced network.

Usage

contract(adj.matrix, nodes, method = c("min", "max", "union", "add"))

Arguments

adj.matrix

Matrix indicating the adjacency matrix of the network. The inputted adjacency matrix for the diffusion centrality should be properly transfomred to the probability interpretation.

nodes

Integer indicating the column index of the chosen player in the adjacenncy matrix.

method

Indication of which grouping criterion should be used.
method="min" indicates the "minimum" criterion (edge values as distances).
method="max" indicates the "maximum" criterion (edge values as non-cummulative strengths).
method="add" indicates the "addition" criterion (edge values as cummulative strengths).
method="union" indicates the "union" criterion (edge values as probability).
The default is "min". See details for examples.

Details

Minimum Criterion: the edge value between a group and an outside node is measured as the minimal value among all the (nonzero) edge values between any node in the group and the outside node. Suggested if edge values are interpreted as distances.
Example: suppose node A to C has distance 2 and B to C has distance 1, then according to the minimum criterion, the distance between C and the merged set AB is 1. Note that if B and C are not connected, the algorithm takes the distance between A and C to describe the distance between AB and C.

Maximun Criterion: the edge value between a group and an outside node is measured as the maximal value among all the (nonzero) edge values between any node in the group and the outside node. Suggested if edge values are interpreted as non-cummulative strengths.
Example: we keep using the above example, but the figure now indicates the strength of tie. According to the maximum criterion, the strength of tie between AB and C is 2.

Addition Criterion: the edge value between a group and an outside node is measured as the sum of all the edge values between any node in the group and the outside node. Suggested if edge values are as cummulative strengths.
Example: according to the addition criterion, the strength of tie between AB and C is 3

Union Criterion: the edge value between a group and an outside node is measured as the probability that there is at least one path connecting the group with the outside node. Suggested if edge values are as probability.
Example: suppose A has probability 0.2 to reach C and B has probability 0.5 to reach C, then C can be reached from merged AB with probability 1-(1-0.2)*(1-0.5)=0.6 according to the union criterion.

Value

A new adjacency matrix after contracting the chosen nodes (named set).

Author(s)

Weihua An [email protected]; Yu-Hsin Liu [email protected]

References

An, Weihua and Yu-Hsin Liu (2016). "keyplayer: An R Package for Locating Key Players in Social Networks." The R Journal, 8(1): 257-268.

See Also

kpcent; kpset

Examples

# Create a 5x5 weighted and directed adjacency matrix, where edge values
# represent the strength of tie
W <- matrix(
  c(0,1,3,0,0,
    0,0,0,4,0,
    1,1,0,2,0,
    0,0,0,0,3,
    0,2,0,0,0),
    nrow=5, ncol=5, byrow = TRUE)

# If the strength is believed to be non-accumulative for a group of nodes,
# it is proper to use the "maximum" criterion to contract node 2 and 3
contract(W,c(2,3),"max")

# Transform the edge value to probability interpretaion
P <- W *0.2

# Contract node 2 and 3 using the "union" criterion as it is proper for
# probability matrix input
contract(P,c(2,3),"union")

Compute the Diffusion Centrality Score in a Network

Description

diffusion measures player's ability to disseminate information through all the possible paths. For each path from i to j there is a reaching probability PijP_{ij}, which is specified in the inputted adjacency matrix.

Usage

diffusion(adj.matrix, node, T = ncol(adj.matrix))

Arguments

adj.matrix

Matrix indicating the probability matrix.

node

Integer indicating the column index of the chosen player in the adjacenncy matrix. If not specified, scores for all nodes will be reported.

T

Integer indicating the maximum number of iterations of communication process. In the first iteration, the adjacency matrix is as the input. In the nth iteration, the adjacency matrix becomes the input adjacency matrix to the power of n. By default, T is the network size.

Details

The diffusion centrality measures the expected number of information receivers from a particular node (Banerjee et.al. 2013). The measure can approximate the degree, Katz-Bonacich, or eigenvector centrality when proper parameters are chosen. See Banerjee et.al. (2014) for details and proofs.

In its original parametrization (Banerjee et.al. 2013), P=q*g, where q is a measure of the information passing probability and g the adjacency matrix. For simplication and consistency with other centrality measures, the current packages asks users to input the probability matrix P directly. With information on q and the adjacency matrix, the probability matrix P can easily be calculated by their product.

Value

A vector indicating the defusion centrality score(s) of the chosen player(s).

Author(s)

Weihua An [email protected]; Yu-Hsin Liu [email protected]

References

An, Weihua and Yu-Hsin Liu (2016). "keyplayer: An R Package for Locating Key Players in Social Networks." The R Journal, 8(1): 257-268.

Banerjee, A., A. Chandrasekhar, E. Duflo, and M. Jackson (2013): "Diffusion of Microfinance," Science, Vol. 341. p.363

Banerjee, A., A. Chandrasekhar, E. Duflo, and M. Jackson (2014): "Gossip: Identifying Central Individuals in a Social Network," Working Paper.

See Also

matpow; kpcent; kpset

Examples

# Create a 5x5 weighted and directed adjacency matrix, where edge values
# represent the strength of tie
W <- matrix(
  c(0,1,3,0,0,
    0,0,0,4,0,
    1,1,0,2,0,
    0,0,0,0,3,
    0,2,0,0,0),
    nrow=5, ncol=5, byrow = TRUE)

# Transform the edge value to probability interpretaion
P <- W *0.2

# List the diffusion centrality score for every node
diffusion(P, T = 2)

Compute the Fragmentation Centrality Score in a Netwrok

Description

fragment measures the extent of fragmentation of a network after a set of nodes is removed from the network. The more fragmented the residual network is, the more central a node is.

Usage

fragment(
  adj.matrix,
  nodes,
  M = Inf,
  binary = FALSE,
  large = TRUE,
  geodist.precomp = NULL
)

Arguments

adj.matrix

Matrix indicating the adjacency matrix of the network.

nodes

Integer indicating the column index of the chosen player in the adjacenncy matrix. If there are multiple players, use c(index1,index2,...). If not specified, scores for all nodes will be reported.

M

Number indicating the maximum geodistance between two nodes, above witch the two nodes are considered disconnected. M hence defines the reachable set. The default is Inf.

binary

Logical scalar. If TRUE, the adjacency matrix is binarized. If FALSE, the edge values are considered. The default is FALSE.

large

Logical scalar, whether the computation method for large network is implemented. If TRUE (the default), the method implmented in igraph is used; otherwise the method implemented in sna is used.

geodist.precomp

Geodistance precomputed for the graph to be analyzed (optional).

Details

A natural way to apply the fragmentation centrality is in the context of counter-terrorism, as shown in Borgatti (2006). The measure uses geodistances to compute the fragmentation level of the residual network, and thus edge values should be properly adjusted to distance interpretation. The fragmentation centrality is not directional as edge values are counted aggregately at the network level.

Value

Vector indicating fragment score(s) of the chosen player(s). Score is normalized to [0,1].

Author(s)

Weihua An [email protected]; Yu-Hsin Liu [email protected]

References

An, Weihua and Yu-Hsin Liu (2016). "keyplayer: An R Package for Locating Key Players in Social Networks." The R Journal, 8(1): 257-268.

Borgatti, Stephen P. 2006. "Identifying Sets of Key Players in a Network." Computational, Mathematical and Organizational Theory, 12(1):21-34.

Butts, Carter T. (2014). sna: Tools for Social Network Analysis. R package version 2.3-2. https://cran.r-project.org/package=sna

Csardi, G and Nepusz, T (2006). "The igraph software package for complex network research." InterJournal, Complex Systems 1695. https://igraph.org/

See Also

geodist; shortest.paths; kpcent; kpset

Examples

# Create a 5x5 weighted and directed adjacency matrix, where edge values
# represent the strength of tie
W <- matrix(
  c(0,1,3,0,0,
    0,0,0,4,0,
    1,1,0,2,0,
    0,0,0,0,3,
    0,2,0,0,0),
    nrow=5, ncol=5, byrow = TRUE)

# Transform the edge value to distance interpretaion
A <- W
A[W!=0] <- 1/W[W!=0]

# List the fragmentation centrality scores for every node
fragment(A)

The friendship network of 21 managers in a high-tech company

Description

The friendship network of 21 managers in a high-tech company

Usage

data("Friends")

Format

A network object for the friendship network of 21 managers in a high-tech company (Krackhardt, 1987). It is a directed network including 21 nodes and 60 edges. There are two node atrributes. "Dept" shows the department affiliations (1-4). "Level" shows the rank of the managers in the company (1-3).

@source D. Krackhardt. "Cognitive social structures." Social Networks, 9:109-134, 1987.


Compute Group Centraltiy in a Network

Description

kpcent reports the group-level centrality scores.

Usage

kpcent(
  adj.matrix,
  nodes,
  type,
  M = Inf,
  T = ncol(adj.matrix),
  method,
  binary = FALSE,
  cmode,
  large = TRUE,
  geodist.precomp = NULL
)

Arguments

adj.matrix

Matrix indicating the adjacency matrix of the network or the probability matrix in the case of calculating diffusion centrality.

nodes

Integer indicating the column index of the chosen player in the adjacenncy matrix. If there are multiple players, use c(index1,index2,...)

type

type="betweenness" for betweenness centrality.
type="closeness" for closeness centrality.
type="degree" for degree centraslity.
type="diffusion" for diffusion centrality.
type="evcent" for evcent (eigenvector) centrality.
type="fragment" for fragment centrality.
type="mreach.degree" for mreach.degree centrality.
type="mreach.closeness" for mreach.closeness centrality.

M

Positive number indicating the maximum geodistance between two nodes, above witch the two nodes are considered disconnected. The default is Inf. The option is applicable to mreach.degree, mreach.closeness, and fragmentation centralities.

T

Integer indicating the maximum number of iterations of communication process. For diffusion centrality only. By default, T is the network size.

method

Indication of which grouping criterion should be used.
"min" indicates the "minimum" criterion and is the default for betweenness, closeness, fragmentation, and M-reach centralities.
"max" indicates the "maximum" criterion and is the default for degree and eigenvector centralities.
"add" indicates the "addition" criterion.
"union" indicates the "union" criterion and is the default for diffusion centrality.
See Details section for explanations on grouping method.

binary

If TRUE, the adjacency matrix is binarized. If FALSE, the edge values are considered. By default, binary=FALSE

cmode

String indicating the type of centrality being evaluated. The option is applicable to degree and M-reach centralities. "outdegree", "indegree", and "total" refer to indegree, outdegree, and (total) degree respectively. "all" reports all the above measures. The default is to report the total degree. Note for closeness centrality, we use the Gil-Schmidt power index when large=FALSE. See closeness for explanation. When large=TRUE, the function reports the standard closeness score.

large

Logical scalar, whether the computation method for large network is implemented. If TRUE (the default), the method implmented in igraph is used; otherwise the method implemented in sna is used.

geodist.precomp

Geodistance precomputed for the graph to be analyzed (optional).

Details

The basic idea of measuring the group-level centrality is to treat a group of nodes as a large pseudo-node. We propose several methods to measure the tie status between this pseudo node and other nodes, responding to several common edge value interpretations (An and Liu, 2015).

Minimum Criterion: the edge value between a group and an outside node is measured as the minimal value among all the (nonzero) edge values between any node in the group and the outside node. Suggested if edge values are interpreted as distances.
Example: suppose node A to C has distance 2 and B to C has distance 1, then according to the minimum criterion, the distance between C and the merged set AB is 1. Note that if B and C are not connected, the algorithm takes the distance between A and C to describe the distance between AB and C.

Maximun Criterion: the edge value between a group and an outside node is measured as the maximal value among all the (nonzero) edge values between any node in the group and the outside node. Suggested if edge values are interpreted as non-cummulative strengths.
Example: we keep using the above example, but the figure now indicates the strength of tie. According to the maximum criterion, the strength of tie between AB and C is 2.

Addition Criterion: the edge value between a group and an outside node is measured as the sum of all the edge values between any node in the group and the outside node. Suggested if edge values are as cummulative strengths.
Example: according to the addition criterion, the strength of tie between AB and C is 3

Union Criterion: the edge value between a group and an outside node is measured as the probability that there is at least one path connecting the group with the outside node. Suggested if edge values are as probability.
Example: suppose A has probability 0.2 to reach C and B has probability 0.5 to reach C, then C can be reached from merged AB with probability 1-(1-0.2)*(1-0.5)=0.6 according to the union criterion.

Value

A vector indicating the centrality score of a group.

Author(s)

Weihua An [email protected]; Yu-Hsin Liu [email protected]

References

An, Weihua. (2015). "Multilevel Meta Network Analysis with Application to Studying Network Dynamics of Network Interventions." Social Networks 43: 48-56.

An, Weihua and Yu-Hsin Liu (2016). "keyplayer: An R Package for Locating Key Players in Social Networks." The R Journal, 8(1): 257-268.

Banerjee, A., A. Chandrasekhar, E. Duflo, and M. Jackson (2013): "Diffusion of Microfinance," Science, Vol. 341. p.363

Banerjee, A., A. Chandrasekhar, E. Duflo, and M. Jackson (2014): "Gossip: Identifying Central Individuals in a Social Network," Working Paper.

Borgatti, Stephen P. (2006). "Identifying Sets of Key Players in a Network." Computational, Mathematical and Organizational Theory, 12(1):21-34.

Butts, Carter T. (2014). sna: Tools for Social Network Analysis. R package version 2.3-2. https://cran.r-project.org/package=sna

Csardi, G and Nepusz, T (2006). "The igraph software package for complex network research." InterJournal, Complex Systems 1695. https://igraph.org/

See Also

contract kpset

Examples

# Create a 5x5 weighted and directed adjacency matrix,
# where edge values represent the strength of tie
W <- matrix(
  c(0,1,3,0,0,
    0,0,0,4,0,
    1,1,0,2,0,
    0,0,0,0,3,
    0,2,0,0,0),
    nrow=5, ncol=5, byrow = TRUE)

# List the degree centrality for group of node 2 and 3
kpcent(W,c(2,3),type="degree")

# Transform the edge value to distance interpretaion
# Compute the fragmentation centrality for node 2
A <- W
A[W!=0] <- 1/W[W!=0]
kpcent(A,2,type="fragment")

# Replicate the group-level degree centrality (normalized) when the weights
# are given by the inverse distances and report the outgoing score only
kpcent(A,c(2,3),type="mreach.closeness",binary=TRUE,M=1,cmode="outdegree")

# Transform the edge value to probability interpretation
# Compute the diffusion centrality with number of iteration 20
P <- 0.1*W
kpcent(P,c(2,3),type="diffusion",T=20)

Selecting the Most Central Group of Players in a Network

Description

kpset helps identify the most central group of players in a social network given a sepcified centraliy measure and a target group size.

Usage

kpset(
  adj.matrix,
  size,
  type = "degree",
  M = Inf,
  T = ncol(adj.matrix),
  method = "min",
  binary = FALSE,
  cmode = "total",
  large = TRUE,
  geodist.precomp = NULL,
  seed = "top",
  parallel = FALSE,
  cluster = 2,
  round = 10,
  iteration = ncol(adj.matrix)
)

Arguments

adj.matrix

Matrix indicating the adjacency matrix of the network or in the case of diffusion centrality a probability matrix.

size

Integer indicating the target size of players.

type

A string indicating the type of centrality measure to be used. Should be one of "degree" for degree centrality, "closeness" for closeness centrality, "betweenness" for betweenness centrality, "evcent" for eigenvector centrality, "mreach.degree" for M-reach degree centrality, "mreach.closeness" for M-reach closeness centrality, "fragment" for fragment centrality, and "diffusion" for diffusion centrality.

M

Positive number indicating the maximum geodistance between two nodes, above which the two nodes are considered disconnected. The default is Inf. The option is applicable to M-reach degree, M-reach closeness, and fragmentation centralities..

T

Integer indicating the maximum number of iterations in the communication process. By default, T is the network size.

method

Indication of which grouping criterion should be used.
"min" indicates the "minimum" criterion and is suggested for betweenness, closeness, fragmentation, and M-reach centralities.
"max" indicates the "maximum" criterion and is suggested for degree and eigenvector centralities.
"add" indicates the "addition" criterion and is suggested for degree and eigenvector centralities as an altenative of "max".
"union" indicates the "union" criterion and is suggested for diffusion centrality.
The default is "min". See kpcent Details section for explanations on grouping method.

binary

If TRUE, the input matrix is binarized. If FALSE, the edge values are considered. The default is FALSE.

cmode

String indicating the type of centrality being evaluated. The option is applicable to degree and M-reach centralities. "outdegree", "indegree", and "total" refer to indegree, outdegree, and total degree, respectively. "all" reports all the above measures. The default is to report the total degree. Note for closeness centrality, we use the Gil-Schmidt power index when large=FALSE. See closeness for explanation. When large=TRUE, the function reports the standard closeness score.

large

Logical scalar. If TRUE (the default), the method implmented in igraph is used for computing geodistance and related centrality measures; otherwise the method in sna is used.

geodist.precomp

Geodistance precomputed for the network to be analyzed (optional).

seed

String indicating the seeding method or a vector of the seeds specified by user. If "top", players with the high individual centrality are used as the seeds. If "random", seeds are randomly sampled. The default is "top" for efficiency.

parallel

Logical scalar. IF TRUE, the parallel computation is implement. The default is FALSE.

cluster

Integer indicating the number of CPU cores to be used for parallel computation.

round

Integer indicating the "length" of search, namely, the number of loops over the nodes in the candidate set.

iteration

Integer indicating the "width" of search in each round, namely, the number of loops over the nodes in the residual set.

Details

The most central group of players in a network is not necessarily the set of players who are the most central as individuals because there may be redundancy in their connections. Currenlty a greedy search algorithm is implemented in this package to identify the most central group of key players. The basic steps are shown as follows.

  1. Select an initial candidate set C. The residual set is denoted as R.

  2. Update the candidate set C.

    • Start with the first node in C. Try to swap it with nodes in R sequentially (loop 1). Make the swap if it improves the centrality score of the resulting C. The number of loop 1 is defined as the number of iterations (over the nodes in the residual set).

    • Repeat step 1 for each node in C sequentially (loop 2). The number of loop 2 is defined as the number of rounds (over the nodes in the candidate set).

    • Stop if (a) the change in C's centrality score is negligible (i.e. it is smaller than a pre-specified threshold determined by both the network size and edge values.) or (b) the process reaches a specified number of rounds.

  3. Return the final candidate set and the centrality score.

It is recommended to run kpset several times with different seeds so that the algorithm will not be trapped in a local optimum. To facilitate the search in large networks, users may specify a reasonable number of iterations or rounds and/or utilize parallel computation. During parallel computation, for each cluster and each iteration the algorithm randomly picks a node from the candidate set and the residual set, respectively, and swaps the two if it improves the centrality score of the candidate set. It repeats this process until exhausting the specified iterations and rounds and then compare and combine the results from the clusters.

Value

kpset returns the column indices of the players who form the most central set and its centrality score.

Author(s)

Weihua An [email protected]; Yu-Hsin Liu [email protected]

References

An, Weihua. (2015). "Multilevel Meta Network Analysis with Application to Studying Network Dynamics of Network Interventions." Social Networks 43: 48-56.

An, Weihua and Yu-Hsin Liu (2016). "keyplayer: An R Package for Locating Key Players in Social Networks." The R Journal, 8(1): 257-268.

Borgatti, Stephen P. (2006). "Identifying Sets of Key Players in a Network." Computational, Mathematical and Organizational Theory, 12(1):21-34.

Butts, Carter T. (2014). sna: Tools for Social Network Analysis. R package version 2.3-2. https://CRAN.R-project.org/package=sna

Csardi, G and Nepusz, T (2006). "The igraph software package for complex network research." InterJournal, Complex Systems 1695. https://igraph.org

See Also

kpcent

Examples

# Create a 5x5 weighted and directed adjacency matrix
W <- matrix(
  c(0,1,3,0,0,
    0,0,0,4,0,
    1,1,0,2,0,
    0,0,0,0,3,
    0,2,0,0,0),
    nrow=5, ncol=5, byrow = TRUE)

# Find the most central player set sized 2 in terms of the degree centrality
kpset(W,size=2,type="degree")

# Find two most central players in terms of indegree
# via parallel computation using 5 cpu cores
kpset(W,size=2,type="degree", cmode="indegree", parallel = TRUE, cluster = 2)

Compute the M-reach Closeness Centrality Score in a Netwrok

Description

mreach.closeness refines the mreach.degree centrality by using the (inverse) geodistance as weights. The edge values should be properly interpreted as distances.

Usage

mreach.closeness(
  adj.matrix,
  node,
  M = Inf,
  binary = FALSE,
  cmode = "all",
  large = TRUE,
  geodist.precomp = NULL
)

Arguments

adj.matrix

Matrix indicating the adjacency matrix of the network.

node

Integer indicating the column index of the chosen player in the adjacenncy matrix. If not specified, scores for all nodes will be reported.

M

Number indicating the maximum geodistance between two nodes, above witch the two nodes are considered disconnected. M hence defines the reachable set. The default is Inf.

binary

Logical scalar. If TRUE, the adjacency matrix is binarized. If FALSE, the edge values are considered.

cmode

String indicating the type of centrality being evaluated. "outdegree", "indegree", and "total" refer to indegree, outdegree, and (total) degree respectively. "all" reports all the above measures and is the default.

large

Logical scalar, whether the computation method for large network is implemented. If TRUE (the default), the method implmented in igraph is used; otherwise the method implemented in sna is used.

geodist.precomp

Geodistance precomputed for the graph to be analyzed (optional).

Details

mreach.closeness refines the mreach.degree centrality by using the (inverse) geodistance as weights, just as closeness centrality refines degree centrality. It captures the degree centrality when M is properly set (e.g. M=1 in a binarized network). It captures the Gil-Schmidt power index (Gil and Schmidt, 1996) and the cohesion centrality (Borgatti, 2006) when M is sufficiently large (unconstrained). The normalization factor takes care of non-binary edge values. Also note that the geodistance matrix does not necessarily to be symmetric.

Value

A vector indicating the outdegree, indegree, or total-degree cohesion score of the chosen player; or a data frame containing all the above information. Note that the outdegree and indegree scores are normalized to [0,1]. This means that the total-degree score is between [0,2].

Author(s)

Weihua An [email protected]; Yu-Hsin Liu [email protected]

References

An, Weihua and Yu-Hsin Liu (2016). "keyplayer: An R Package for Locating Key Players in Social Networks." The R Journal, 8(1): 257-268.

Borgatti, Stephen P. (2006). "Identifying Sets of Key Players in a Network." Computational, Mathematical and Organizational Theory, 12(1):21-34.

Butts, Carter T. (2014). sna: Tools for Social Network Analysis. R package version 2.3-2. https://cran.r-project.org/package=sna

Csardi, G and Nepusz, T (2006). "The igraph software package for complex network research." InterJournal, Complex Systems 1695. https://igraph.org/

Gil, J and Schmidt, S (1996). "The Origin of the Mexican Network of Power." Proceedings of the International Social Network Conference, Charleston, SC, 22-25.

See Also

geodist; shortest.paths; mreach.degree; kpcent; kpset

Examples

# Create a 5x5 weighted and directed adjacency matrix, where edge values
# represent the strength of tie
W <- matrix(
  c(0,1,3,0,0,
    0,0,0,4,0,
    1,1,0,2,0,
    0,0,0,0,3,
    0,2,0,0,0),
    nrow=5, ncol=5, byrow = TRUE)

# Transform the edge value to distance interpretaion
A <- W
A[W!=0] <- 1/W[W!=0]

# List all types of 2-reach closeness scores for every node
mreach.closeness(A,M=2,cmode="all",large=FALSE)

Compute the M-reach Degree Centrality Score in a Netwrok

Description

mreach.degree computes the size of reachable nodes from a particular node within M steps. M-reach degree centrality generalizes the degree centrality by delimiting specific neighborhoods.

Usage

mreach.degree(
  adj.matrix,
  node,
  M = Inf,
  binary = TRUE,
  cmode = "all",
  large = TRUE,
  geodist.precomp = NULL
)

Arguments

adj.matrix

Matrix indicating the adjacency matrix of the network.

node

Integer indicating the column index of the chosen player in the adjacenncy matrix. If not specified, scores for all nodes will be reported.

M

Number indicating the maximum geodistance between two nodes, above which the two nodes are considered disconnected. M hence defines the reachable set. The default is Inf.

binary

Logical scalar. If TRUE, the adjacency matrix is binarized, and thus M essentially means steps. If FALSE, the edge values are considered.

cmode

String indicating the type of centrality being evaluated. "outdegree", "indegree", and "total" refer to indegree, outdegree, and (total) degree respectively. "all" reports all the above measures and is the default.

large

Logical scalar, whether the computation method for large network is implemented. If TRUE (the default), the method implmented in igraph is used; otherwise the method implemented in sna is used.

geodist.precomp

Geodistance precomputed for the graph to be analyzed (optional).

Details

The interprtation of the measure in binary and weighted adjacency matrix are slightly different. In binary networks, the reachable set of nodes is defined by nodes that are reachable within M steps. In weighted networks, the reachable set is defined by nodes that are reachable within geodistance M.

Value

A vector indicating the outdegree, indegree, or total-degree mreach.degree score of the chosen node; or a data frame containing all the above information.

Author(s)

Weihua An [email protected]; Yu-Hsin Liu [email protected]

References

An, Weihua and Yu-Hsin Liu (2016). "keyplayer: An R Package for Locating Key Players in Social Networks." The R Journal, 8(1): 257-268.

Butts, Carter T. (2014). sna: Tools for Social Network Analysis. R package version 2.3-2. https://cran.r-project.org/package=sna

Csardi, G and Nepusz, T (2006). "The igraph software package for complex network research." InterJournal, Complex Systems 1695. https://igraph.org/

See Also

geodist; shortest.paths; mreach.closeness; kpcent; kpset

Examples

# Create a 5x5 weighted and directed adjacency matrix,
# where edge values represent the strength of tie
W <- matrix(
  c(0,1,3,0,0,
    0,0,0,4,0,
    1,1,0,2,0,
    0,0,0,0,3,
    0,2,0,0,0),
    nrow=5, ncol=5, byrow = TRUE)


# List the 2-reach degree scores for every node where W is binarized
mreach.degree(W,M=2,cmode="all",large=FALSE)