pub fn reach_decay(graph: &Graph) -> IgraphResult<f64>Expand description
Average fraction of vertices reachable within half the diameter.
For each vertex, computes the fraction of other vertices reachable
within floor(diameter / 2) hops, then averages across all vertices.
Measures how quickly connectivity “fills in” relative to the graph’s
diameter.
Returns 0.0 for disconnected or trivial graphs.
§Examples
use rust_igraph::{Graph, reach_decay};
// K4: diameter=1, half=0 → no vertex reachable in 0 hops → 0
// Actually half_diam = floor(1/2) = 0, so reach = 0
let g = Graph::from_edges(
&[(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)],
false,
Some(4),
)
.unwrap();
let r = reach_decay(&g).unwrap();
assert!(r >= 0.0 && r <= 1.0);