Skip to main content

resistance_centrality

Function resistance_centrality 

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

Compute resistance centrality for all vertices.

C_R(v) = (n-1) / Σ_{u≠v} R(v,u)

Vertices with lower total resistance to all others receive higher centrality scores. Returns 0.0 for isolated vertices.

§Examples

use rust_igraph::{Graph, resistance_centrality};

// K_3: all vertices equivalent, so equal centrality
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let c = resistance_centrality(&g).unwrap();
assert!((c[0] - c[1]).abs() < 0.01);
assert!((c[1] - c[2]).abs() < 0.01);