Skip to contents

Computes the small-world coefficient sigma, defined as: sigma = (C / C_rand) / (L / L_rand) where C is clustering coefficient, L is mean path length, and _rand are values from equivalent random graphs.

Usage

network_small_world(x, n_random = 10, ...)

Arguments

x

Network input: matrix, igraph, network, cograph_network, or tna object

n_random

Number of Erdos-Renyi comparison graphs (same n and m as the observed graph). Default 10.

...

Passed to to_igraph, whose only other argument is directed; anything else raises an "unused argument" error.

Value

Numeric: small-world coefficient sigma. NA when the graph has fewer than 4 nodes, no edges, or an undefined/zero mean path length.

Details

Values > 1 indicate small-world properties. Typically small-world networks have sigma >> 1.

Reproducibility

The comparison graphs are drawn from the caller's RNG stream; this function takes no seed argument and does not save or restore .Random.seed. Call set.seed() beforehand for a reproducible result, and prefer a larger n_random than the default for anything you report.

Examples

# Watts-Strogatz small-world graph
if (requireNamespace("igraph", quietly = TRUE)) {
  g <- igraph::sample_smallworld(1, 20, 3, 0.1)
  network_small_world(g)  # Should be > 1
}
#> [1] 1.264929