pub fn reciprocity_ratio(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the reciprocity ratio of the graph.
For directed graphs, the fraction of directed edges (u,v) for which
the reverse edge (v,u) also exists. For undirected graphs, returns
1.0 (every edge is trivially reciprocal). Returns 0.0 for graphs
with no edges.
§Examples
use rust_igraph::{Graph, reciprocity_ratio};
// Undirected triangle → all reciprocal → 1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((reciprocity_ratio(&g).unwrap() - 1.0).abs() < 1e-10);