Skip to main content

centralization

Function centralization 

Source
pub fn centralization(
    scores: &[f64],
    theoretical_max: f64,
    normalized: bool,
) -> f64
Expand description

Computes the graph-level centralization index from vertex-level scores (igraph_centralization).

The (unnormalized) centralization is C = Σ_v (max_u c_u − c_v), the sum of the deviations from the largest score. If normalized is true, C / theoretical_max is returned instead, where theoretical_max is the centralization of the most centralized structure with the same number of vertices (usually a star, see e.g. centralization_degree_tmax); it is ignored otherwise. An empty scores slice gives NaN. Time complexity: O(n), the number of scores.

Binds igraph_centralization.

§Examples

use igraph::centrality::centralization;

assert_eq!(centralization(&[3.0, 1.0, 1.0, 1.0], 0.0, false), 6.0);
assert_eq!(centralization(&[3.0, 1.0, 1.0, 1.0], 6.0, true), 1.0);