Skip to main content

random_geometric_graph

Function random_geometric_graph 

Source
pub fn random_geometric_graph<R: Rng>(
    n: usize,
    radius: f64,
    rng: &mut R,
) -> Result<Graph<usize, f64>>
Expand description

Generates a random geometric graph

In a random geometric graph, n points are placed uniformly at random in the unit square [0,1)^2. An edge is created between two nodes whenever their Euclidean distance is at most radius.

§Arguments

  • n - Number of nodes
  • radius - Connection radius (typical range: 0.05 to 0.5)
  • rng - Random number generator

§Returns

  • Result<Graph<usize, f64>> - The generated graph where edge weights are the Euclidean distances between connected nodes

§Applications

Models wireless sensor networks, ad-hoc networks, and spatial networks where connectivity depends on physical proximity.