Skip to main content

betweenness_centralization

Function betweenness_centralization 

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

Compute betweenness centralization.

sum(max_bc - bc[v]) / ((n-1)*(n-2)) — Freeman betweenness centralization normalized by the theoretical maximum for a star graph. Uses unnormalized betweenness (divided by 2 for undirected graphs). Returns 0.0 for graphs with fewer than 3 vertices.

§Examples

use rust_igraph::{Graph, betweenness_centralization};

// K_3: all betweenness = 0 → centralization = 0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!(betweenness_centralization(&g).unwrap().abs() < 1e-10);