Skip to main content

edge_overlap_sum

Function edge_overlap_sum 

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

Compute the sum of overlap coefficients across all edges.

Σ_{(u,v)∈E} |N(u) ∩ N(v) \ {u,v}| / min(|N(u)\{v}|, |N(v)\{u}|)

Each edge contributes a value in [0, 1]. Edges where min neighbor count (excluding the other endpoint) is zero contribute 0. Self-loops are skipped. Returns 0.0 for the empty graph.

§Examples

use rust_igraph::{Graph, edge_overlap_sum};

// K_3: each edge: |{w}| / min(1,1) = 1 → 3·1 = 3.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((edge_overlap_sum(&g).unwrap() - 3.0).abs() < 1e-10);