Skip to main content

resistance_regularity

Function resistance_regularity 

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

Compute the resistance regularity ratio.

For each edge (u,v), the effective resistance is at least 1/min(deg(u),deg(v)) and at most 1. We use 1/min(deg(u), deg(v)) as a proxy for edge resistance, then compute min_resistance / max_resistance over all edges. Values near 1 indicate uniform edge resistances (regular graph); values near 0 indicate highly non-uniform resistances. Returns 0.0 for trivial or edgeless graphs.

§Examples

use rust_igraph::{Graph, resistance_regularity};

// K_3: all edges have same resistance → ratio = 1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((resistance_regularity(&g).unwrap() - 1.0).abs() < 1e-10);