targbetween: Targeted Betweenness Centrality for Specified Dyads

Description Usage Arguments Details Value Examples

View source: R/targbetween.R

Description

This function computes targeted betweenness centrality for a specified set of dyads. targbetween is more flexible than targbetween_alldyads, allowing different source vertices to correspond to different destination vertices.

Usage

1
targbetween(network, dyads, filename = NULL, directed = FALSE, update = 0)

Arguments

network

An igraph network graph

dyads

A two-column data.frame, with two vertices in each row, indicating the dyads to be considered in the analysis

filename

A character value indicating the file location to output results (default = NULL)

directed

A boolean value indicating whether the network should be treated as directed (default = FALSE)

update

A numeric value indicating how many loop iterations should elapse between progress updates (default = 0, which suppresses output)

Details

WARNING: This function calls assorted_dyads, which may be extremely slow when the number of rows in dyads is large, as all_shortest_paths must be separately run for each individual dyad. If all source vertices correspond to the same set of destination vertices, targbetween_alldyads should be used instead of targbetween. The targbetween_alldyads function takes a vector of source vertices and a vector of destination vertices as arguments, and it is either length(source) or length(destination) times faster than targbetween, whichever is larger.

Value

A data.frame with the results for targeted betweenness centrality

Examples

 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
my_network <- igraph::erdos.renyi.game(20, 0.5, directed = FALSE)
various_dyads <- cbind(c(1,1,2,2,3,3,4,4,5,5),c(3,4,1,8,18,20,1,15,3,10))
results <- targbetween(my_network, various_dyads, directed=FALSE)
results
#       vertices targeted_betweenness
#  [1,] "1"      "0.2"               
#  [2,] "2"      "0"                 
#  [3,] "3"      "0.166666666666667" 
#  [4,] "4"      "0"                 
#  [5,] "5"      "0.2"               
#  [6,] "6"      "0.166666666666667" 
#  [7,] "7"      "0.166666666666667" 
#  [8,] "8"      "0.166666666666667" 
#  [9,] "9"      "0"                 
# [10,] "10"     "0.166666666666667" 
# [11,] "11"     "0.166666666666667" 
# [12,] "12"     "0.166666666666667" 
# [13,] "13"     "0.166666666666667" 
# [14,] "14"     "0.166666666666667" 
# [15,] "15"     "0.366666666666667" 
# [16,] "16"     "0.166666666666667" 
# [17,] "17"     "0"                 
# [18,] "18"     "0"                 
# [19,] "19"     "0.2"               
# [20,] "20"     "0.366666666666667" 

bcbritt/targbetween documentation built on April 21, 2021, 6:12 p.m.