pub fn sample_negative_edges_degree_biased(
graph: &Graph,
count: usize,
seed: u64,
) -> IgraphResult<Vec<(VertexId, VertexId)>>Expand description
Sample negative edges proportional to vertex degree (popularity-biased).
Higher-degree vertices are more likely to appear in sampled non-edges. This produces harder negatives for link prediction since they involve popular nodes that could plausibly have edges.
ยงExamples
use rust_igraph::{Graph, sample_negative_edges_degree_biased};
// Star: vertex 0 has degree 4, others degree 1
let g = Graph::from_edges(
&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)
).unwrap();
let neg = sample_negative_edges_degree_biased(&g, 3, 42).unwrap();
assert_eq!(neg.len(), 3);
for &(u, v) in &neg {
assert!(!g.has_edge(u, v));
}