Skip to main content

smallworld_sigma

Function smallworld_sigma 

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

Compute the small-world sigma estimate.

(C / C_rand) / (L / L_rand) where:

  • C is the global clustering coefficient
  • L is the average shortest path length
  • C_rand = mean_degree / n (expected clustering for Erdos-Renyi)
  • L_rand = ln(n) / ln(mean_degree) (expected path length for ER)

Values > 1 suggest small-world structure. Returns 0.0 for disconnected, trivial, or sparse graphs where the ratio is undefined.

§Examples

use rust_igraph::{Graph, smallworld_sigma};

// K_4: C=1, L=1, C_rand=3/4, L_rand=ln4/ln3
// sigma = (1/(3/4)) / (1/(ln4/ln3)) = (4/3) * (ln4/ln3) ≈ 1.59
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!(smallworld_sigma(&g).unwrap() > 1.0);