pub fn navigability_ratio(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the navigability ratio.
ln(n) / L — how close the average path length is to the
theoretical minimum for a graph with logarithmic diameter.
Values near 1 suggest the graph is navigable like a random
graph. Returns 0.0 for disconnected or trivial graphs.
§Examples
use rust_igraph::{Graph, navigability_ratio};
// K_4: L=1, ln(4)≈1.386 → ratio≈1.386
let g = Graph::from_edges(
&[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
let r = navigability_ratio(&g).unwrap();
assert!((r - 4.0_f64.ln()).abs() < 1e-10);