This vignette describes the importance of indirect relations on networks, how they are used in centrality indices and how they are implemented in the netrankr
package.
A one-mode network can be described as a dyadic variable \(x\in \mathcal{W}^\mathcal{D}\), where \(\mathcal{W}\) is the value range of the network (in the simple case of unweighted networks \(\mathcal{W}=\{0,1\}\)) and \(\mathcal{D}=\mathcal{N}\times\mathcal{N}\) describes the dyadic domain of actors \(\mathcal{N}\).
Observed presence or absence of ties (the value range is binary) is usually not the relation of interest for network analytic tasks. Instead, mostly implicitly, relations are transformed into a new set of indirect relations on the basis of the observed relations. As an example, consider (shortest path) distances in the underlying graph. While they are fairly easy to derive from an observed network of contacts, it is impossible for actors in a network to answer the question “How far away are you from others you are not connected with?”. We denote generic transformed networks from an observed network \(x\) as \(\tau(x)\).
With this notion of indirect relations, we can express centrality indices in a common framework as \[
c_\tau(i)=\sum\limits_{t \in \mathcal{N}} \tau(x)_{it}
\] Degree and closeness centrality, for instance, can be obtained by setting \(\tau=id\) and \(\tau=dist\), respectively. Others need several additional specifications which can be found in Brandes (2016) or Schoch & Brandes (2016).
With this framework, we can characterize centrality indices as degree-like measures in a suitably transformed network \(\tau(x)\).
netrankr
packagelibrary(netrankr)
library(igraph)
The netrankr
package implements a great variety of indirect relations that are (or could be) used for centrality related considerations in a network. All indirect relations can be computed with the indirect_relations()
function, by specifying the type
parameter.
data("dbces11")
<- dbces11
g
#adjacency
<- indirect_relations(g,type = "identity") A
## Warning in indirect_relations(g, type = "identity"): type="identity" is deprecated. Using "adjacency" instead.
#shortest path distances
<- indirect_relations(g,type="dist_sp")
D #dyadic dependencies (as used in betweenness centrality)
<- indirect_relations(g,type = "depend_sp")
B #resistance distance (as used in information centrality)
<- indirect_relations(g,type="dist_resist")
R #Logarithmic forest distance (parametrized family of distances)
<- indirect_relations(g, type = "dist_lf",lfparam = 1)
LF #Walk distance (parametrized family of distances)
<- indirect_relations(g, type = "dist_walk",dwparam = 0.001)
WD #Random walk distance
<- indirect_relations(g, type = "dist_rwalk")
WD #See ?indirect_relations for further options
The function takes an additional parameter FUN
which can be used to pass a function to further transform relations. The main use is to obtain indirect relations based on walk counts.
#count the limit proportion of walks (used for eigenvector centrality)
<- indirect_relations(g,type = "walks",FUN = walks_limit_prop)
W #count the number of walks of arbitrary length between nodes, weighted by
#the inverse factorial of their length (used for subgraph centrality)
<- indirect_relations(g,type = "walks",FUN = walks_exp) S
Additional parameters can also be passed to calculate parameterized versions of relations.
#Calculate dist(s,t)^-alpha
<- indirect_relations(g,type="dist_sp",FUN=dist_dpow,alpha = 2) D
To view all predefined transformation functions see ?transform_relations
. The predefined functions follow the naming scheme <relation>_<transformation>
. The functions dist_
are thus only meaningful fordistance type relations such as type="dist_sp"
or type="dist_resist"
. Equivalently, walks_
for type="walks"
. The predefined functions are not exhaustive and just constitute the most common transformations. It is, however, straightforward to pass your own transformation function.
<- function(x){
dist_integration <- 1 - (x - 1)/max(x)
x
}<- indirect_relations(g,type="dist_sp",FUN=dist_integration) D
The function dist_integration()
computes \[
\tau(x)_{ij}=1-\frac{dist(i,j)-1}{max_{i,j}\; dist(i,j)}
\] which is used in the centrality index integration defined by Valente and Foreman (1998)
The computed relations CAN be used to build centrality indices (e.g. with the provided Rstudio index_builder()
), but also to derive partial rankings with positional_dominance()
. Consult the respective vignette for help.