Skip to main content

efficiency_ratio

Function efficiency_ratio 

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

Compute the efficiency ratio.

global_efficiency / max_efficiency where global_efficiency is the average inverse shortest-path length over all pairs, and max_efficiency = 1 (the efficiency of a complete graph). Equivalent to just the global efficiency for simple graphs. Returns 0.0 for graphs with fewer than 2 vertices.

ยงExamples

use rust_igraph::{Graph, efficiency_ratio};

// K_3: all pairs at distance 1, eff = 1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((efficiency_ratio(&g).unwrap() - 1.0).abs() < 1e-10);