Skip to main content

grg_game_with_coords

Function grg_game_with_coords 

Source
pub fn grg_game_with_coords(
    n: u32,
    radius: f64,
    torus: bool,
    seed: u64,
) -> IgraphResult<(Graph, Vec<f64>, Vec<f64>)>
Expand description

Same as grg_game but also returns the point coordinates.

The first vector is xs in ascending order — xs[i] is the x-coordinate of vertex i. The second vector is ys in generation order (i.e. not paired with xs[i]), mirroring upstream igraph_grg_game(..., x, y) which sorts only the x array. Callers who need the original (x, y) pairing should generate the points themselves and call grg_game separately.

§Errors

Same as grg_game.

§Examples

use rust_igraph::grg_game_with_coords;

let (g, xs, ys) = grg_game_with_coords(20, 0.4, false, 42).unwrap();
assert_eq!(g.vcount(), 20);
assert_eq!(xs.len(), 20);
assert_eq!(ys.len(), 20);