Skip to main content

smallworld_omega

Function smallworld_omega 

Source
pub fn smallworld_omega(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute the small-world omega estimate.

L_rand / L - C / C_lattice where:

  • L_rand = ln(n) / ln(mean_degree) (ER expected)
  • C_lattice = 3/4 (ring lattice approximation for k≥4)

Values near 0 suggest small-world; negative → lattice-like; positive → random-like. Returns 0.0 for disconnected, trivial, or sparse graphs.

§Examples

use rust_igraph::{Graph, smallworld_omega};

// K_4: highly clustered and short paths
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
let w = smallworld_omega(&g).unwrap();
assert!(w > -2.0 && w < 2.0);