Skip to main content

average_local_efficiency

Function average_local_efficiency 

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

Average of local_efficiency over all N vertices. By upstream convention, returns 0.0 when vcount < 3 (no vertex can have two distinct neighbours, so every per-vertex value is trivially 0).

Counterpart of igraph_average_local_efficiency(_, NULL_weights, _, /*directed=*/true, /*mode=*/IGRAPH_OUT).

ยงExamples

use rust_igraph::{Graph, average_local_efficiency};

// K4: every vertex has local efficiency 1.0, so the average is 1.0.
let mut g = Graph::with_vertices(4);
for i in 0..4u32 {
    for j in (i + 1)..4u32 { g.add_edge(i, j).unwrap(); }
}
assert_eq!(average_local_efficiency(&g).unwrap(), 1.0);