Skip to main content

beta_weighted_gabriel_graph

Function beta_weighted_gabriel_graph 

Source
pub fn beta_weighted_gabriel_graph(
    points: &[Vec<f64>],
    max_beta: f64,
) -> IgraphResult<BetaWeightedGabriel>
Expand description

Build the β-weighted Gabriel graph of a point set.

points holds one row per point with a shared, arbitrary dimensionality (inferred from the first row). max_beta is the search cutoff and must be at least 1.0 (it may be f64::INFINITY for no cutoff); the threshold β of any edge is itself ≥ 1, so a smaller cutoff would be meaningless.

The result’s graph is exactly the Gabriel graph; weights[e] is the β-threshold of edge e.

This is an O(n²) candidate enumeration with an O(n·d) per-pair point scan (O(n³·d) overall). See the module docs for why this reproduces the reference’s Delaunay-seeded, k-d-tree-pruned result exactly.

§Errors

§Examples

use rust_igraph::beta_weighted_gabriel_graph;

// The four corners of a unit square. The Gabriel graph keeps the four
// sides; each side leaves the β-skeleton only as β → ∞ (no point ever
// enters its lune), so every weight is infinite.
let pts = vec![
    vec![0.0, 0.0],
    vec![1.0, 0.0],
    vec![0.0, 1.0],
    vec![1.0, 1.0],
];
let res = beta_weighted_gabriel_graph(&pts, f64::INFINITY).unwrap();
assert_eq!(res.graph.ecount(), 4); // sides only
assert!(res.weights.iter().all(|w| w.is_infinite()));