Skip to main content

local_efficiency_ratio

Function local_efficiency_ratio 

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

Compute the local efficiency ratio.

mean_local_eff / global_eff — how the average vertex’s local efficiency compares to the global efficiency. Returns 0.0 if global efficiency is zero or for trivial graphs.

Local efficiency of vertex v is the average inverse distance between v’s neighbors (using full-graph distances).

§Examples

use rust_igraph::{Graph, local_efficiency_ratio};

// K_3: global_eff=1.0, each vertex's neighbors form K_2 → local_eff=1.0 → ratio=1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((local_efficiency_ratio(&g).unwrap() - 1.0).abs() < 1e-10);