Skip to main content

edge_heterophily

Function edge_heterophily 

Source
pub fn edge_heterophily(graph: &Graph, labels: &[u32]) -> IgraphResult<f64>
Expand description

Heterophily ratio: 1 - edge_homophily.

Convenience function returning the complement of edge homophily. Higher values indicate edges predominantly connect different-label vertices.

§Examples

use rust_igraph::{Graph, edge_heterophily};

let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
let h = edge_heterophily(&g, &[0, 1, 0]).unwrap();
// Both edges cross labels → heterophily = 1.0
assert!((h - 1.0).abs() < 1e-10);