Skip to main content

dot_product_game

Function dot_product_game 

Source
pub fn dot_product_game(
    vecs: &[Vec<f64>],
    directed: bool,
    seed: u64,
) -> IgraphResult<Graph>
Expand description

Sample a random dot-product graph (Nickel 2006) — silent variant.

Equivalent to dot_product_game_with_warnings but discards the clamp-regime flags. Use this when the latent positions are known to live in [0, 1] and the warning bits are not useful.

See dot_product_game_with_warnings for full semantics, error modes, and complexity.

§Examples

use rust_igraph::dot_product_game;

let vecs = vec![vec![0.5, 0.1], vec![0.4, 0.2], vec![0.3, 0.3]];
let g = dot_product_game(&vecs, false, 7).unwrap();
assert_eq!(g.vcount(), 3);
// Simple by construction: at most n(n-1)/2 = 3 edges, no self-loops.
assert!(g.ecount() <= 3);
for e in 0..g.ecount() {
    let (u, v) = g.edge(e as u32).unwrap();
    assert_ne!(u, v);
}