pub fn edge_common_neighbor_sum(graph: &Graph) -> IgraphResult<u64>Expand description
Compute the sum of common neighbor counts across all edges.
Σ_{(u,v)∈E} |N(u) ∩ N(v) \ {u,v}|
Counts the total number of triangles-closing common neighbors. Returns 0 for edgeless or tree-like graphs. Self-loops are skipped.
§Examples
use rust_igraph::{Graph, edge_common_neighbor_sum};
// K_3: each edge shares 1 common neighbor → 3·1 = 3
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(edge_common_neighbor_sum(&g).unwrap(), 3);