pub fn effective_resistance(graph: &Graph, u: u32, v: u32) -> IgraphResult<f64>Expand description
Compute the effective resistance between two vertices.
R(u,v) = L†(u,u) + L†(v,v) - 2·L†(u,v)
For connected undirected graphs only. The effective resistance is
a metric (satisfies triangle inequality) and equals the commute
time divided by 2·|E|.
§Examples
use rust_igraph::{Graph, effective_resistance};
// Path 0-1-2: R(0,2) = 2 (two unit resistors in series)
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
let r = effective_resistance(&g, 0, 2).unwrap();
assert!((r - 2.0).abs() < 0.01);