Measures of centrality
Abstract
Centrality can help in quantifying the importance of species in a network. These function will measure the centrality of all species under different algorithms. There is a single wrapper function called centrality
, which uses an optional first argument to specify the algorithm to use.
The centrality scores are returned so that they sum to one. This is intended to make sure that within a network, the values for different nodes are comparable.
Implemented algorithms
#
SpeciesInteractionNetworks.CentralityMethod
— Type.
CentralityMethod
All algorithms for centrality are subtypes of CentralityMethod
. These algorithms do not take additional arguments, which are instead passed to the centrality
method.
#
SpeciesInteractionNetworks.KatzCentrality
— Type.
KatzCentrality
This type is used to perform the Katz centrality analysis.
References
#
SpeciesInteractionNetworks.EigenvectorCentrality
— Type.
EigenvectorCentrality
This type is used to perform the Eigenvector centrality analysis.
#
SpeciesInteractionNetworks.ClosenessCentrality
— Type.
ClosenessCentrality
Closeness centrality is defined as the reciprocal of farness, i.e. 1 over the sum of shortest paths from the source node to all other nodes. In the case of probabilistic networks, we use the random walk approximation of closeness centrality, where the distance is defined as first passage time.
References
#
SpeciesInteractionNetworks.ResidualClosenessCentrality
— Type.
ResidualClosenessCentrality
References
#
SpeciesInteractionNetworks.GeneralizedClosenessCentrality
— Type.
GeneralizedClosenessCentrality
References
Centrality function
#
SpeciesInteractionNetworks.centrality
— Function.
centrality(N::SpeciesInteractionNetwork{<:Unipartite, <:Union{Binary, Probabilistic}})
If no type is given as the first argument, the centrality function will use ClosenessCentrality
.
centrality(::Type{ClosenessCentrality}, N::SpeciesInteractionNetwork{<:Unipartite, <:Probabilistic})
The closeness centrality of a probabilistic network is measured using the random walk closeness centrality, where the distance between two nodes i and j is measured as the first passage time on node j of a random walk starting on node i. This function does not look for shortest paths, and is therefore reasonably fast.
centrality(::Type{ClosenessCentrality}, N::SpeciesInteractionNetwork{<:Unipartite, <:Binary})
The closeness centrality of a binary network is the reciprocal of the sum of shortest paths.
centrality(::Type{ResidualClosenessCentrality}, N::SpeciesInteractionNetwork{<:Unipartite, <:Binary})
The residual closeness centrality of a binary network is the sum of the residuals of two to the power of the length of shortest paths.
centrality(::Type{GeneralizedClosenessCentrality}, N::SpeciesInteractionNetwork{<:Unipartite, <:Binary}; α=0.1)
The generalized closeness centrality of a binary network ranges from the degree centrality (α is 0) to the number of reachable nodes (α=1).
centrality(::Type{KatzCentrality}, N::SpeciesInteractionNetwork{<:Unipartite, <:Union{Binary, Probabilistic}}; α::AbstractFloat=0.1)
This measure gives a different weight to every subsequent connection (α
). α
is a weight, specifically the attenuation of each subsequent move away from the node, and therefore must be positive.
Note that internally, this function uses linear algebra shortcuts (rather than a sum over path lengths) to calculate the centrality, which is faster. As a consequence, there is, for each network, a maximal value of α that is the reciprocal of the absolute value of the leading eigenvalue of the adjacency matrix. This α has no analytical solution when the adjacency matrix has complex eigenvalues. It is recommended to use this centrality algorithm as part of a try
/catch
block if using large values of α.
References
centrality(::Type{EigenvectorCentrality}, N::SpeciesInteractionNetwork{<:Unipartite, <:Interactions})
Eigencentrality, corrected so that the centralities in the network sum to one.
The eigenvector centrality is calculated using Von Mises iteration, starting from a random vector.
where A is the adjacency matrix of the graph, b is the vector of centralities, At each iteration, the vector is updated to be A×b/|A×b|, and |⋅| is the norm.
The number of iterations is determined by the variable SpeciesInteractionNetworks.CENTRALITY_MAXITER
, and the algorithm usually converges rapidly.
References