Function to aggregate positions defined via indirect relations to construct centrality scores.

aggregate_positions(tau_x, type = "sum")

Arguments

tau_x

Numeric matrix containing indirect relations calculated with indirect_relations.

type

String indicating the type of aggregation to be used. See Details for options.

Value

Scores for the index defined by the indirect relation tau_x and the used aggregation type.

Details

The predefined functions are mainly wrappers around base R functions. type='sum', for instance, is equivalent to rowSums(). A non-base functions is type='invsum' which calculates the inverse of type='sum'. type='self' is mostly useful for walk based relations, e.g. to count closed walks. Other self explanatory options are type='mean', type='min', type='max' and type='prod'.

See also

indirect_relations, transform_relations

Examples

library(igraph)
#> #> Attaching package: ‘igraph’
#> The following object is masked from ‘package:testthat’: #> #> compare
#> The following objects are masked from ‘package:stats’: #> #> decompose, spectrum
#> The following object is masked from ‘package:base’: #> #> union
library(magrittr)
#> #> Attaching package: ‘magrittr’
#> The following objects are masked from ‘package:testthat’: #> #> equals, is_less_than, not
g <- graph.empty(n=11,directed = FALSE) g <- add_edges(g,c(1,11,2,4,3,5,3,11,4,8,5,9,5,11,6,7,6,8, 6,10,6,11,7,9,7,10,7,11,8,9,8,10,9,10)) #degree g %>% indirect_relations(type='identity') %>% aggregate_positions(type='sum')
#> Warning: type="identity" is deprecated. Using "adjacency" instead.
#> [1] 1 1 2 2 3 4 4 4 4 4 5
#closeness centrality g %>% indirect_relations(type='dist_sp') %>% aggregate_positions(type='invsum')
#> [1] 0.03704 0.02941 0.04000 0.04000 0.05000 0.05882 0.05263 0.05556 0.05556 #> [10] 0.05263 0.05556
#betweenness centrality g %>% indirect_relations(type='depend_sp') %>% aggregate_positions(type='sum')
#> [1] 0.000 0.000 0.000 18.000 7.667 19.667 5.333 32.667 14.667 2.667 #> [11] 29.333
#eigenvector centrality g %>% indirect_relations(type='walks',FUN=walks_limit_prop) %>% aggregate_positions(type='sum')
#> [1] 0.27516 0.07864 0.46106 0.29410 0.69521 1.19904 1.21772 1.02121 1.10978 #> [10] 1.21608 1.02901
#subgraph centrality g %>% indirect_relations(type='walks',FUN=walks_exp) %>% aggregate_positions(type='self')
#> [1] 1.825 1.595 3.149 2.423 4.387 7.807 7.939 6.673 7.033 8.242 7.390