Skip to main content

degree_centralization

Function degree_centralization 

Source
pub fn degree_centralization(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute degree centralization.

sum(max_degree - degree[v]) / ((n-1)*(n-2)) — the Freeman degree centralization. Measures how star-like the degree distribution is. Returns 0.0 for graphs with fewer than 3 vertices.

§Examples

use rust_igraph::{Graph, degree_centralization};

// Star graph: maximum centralization = 1.0
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(0,4)], false, Some(5)
).unwrap();
assert!((degree_centralization(&g).unwrap() - 1.0).abs() < 1e-10);