pub fn link_pred_resource_allocation(
graph: &Graph,
pairs: &[(VertexId, VertexId)],
) -> IgraphResult<Vec<f64>>Expand description
Compute Resource Allocation Index for given vertex pairs.
For each pair (u, v), returns Σ_{w ∈ N(u) ∩ N(v)} 1/deg(w).
Similar to Adamic-Adar but uses inverse degree instead of inverse
log-degree, penalizing high-degree common neighbors more strongly.
§Examples
use rust_igraph::{Graph, link_pred_resource_allocation};
let g = Graph::from_edges(
&[(0,1),(0,2),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
let scores = link_pred_resource_allocation(&g, &[(0, 3)]).unwrap();
// Common neighbors of 0,3 are {1,2}; deg(1)=3, deg(2)=3
// RA = 1/3 + 1/3 = 2/3
assert!((scores[0] - 2.0 / 3.0).abs() < 1e-10);