Skip to main content

lune_beta_skeleton

Function lune_beta_skeleton 

Source
pub fn lune_beta_skeleton(points: &[Vec<f64>], beta: f64) -> IgraphResult<Graph>
Expand description

Build the lune-based β-skeleton of a point set.

points holds one row per point with a shared, arbitrary dimensionality (inferred from the first row). beta is the skeleton parameter. The result is an undirected Graph on points.len() vertices.

This is an O(n²·d) candidate enumeration with an O(n·d) empty-lune test per pair. For β ≥ 1 the β-skeleton is a subgraph of the Delaunay triangulation, so testing every pair yields the same edge set as the reference’s Delaunay-pruned candidate superset; for β < 1 the reference itself starts from the complete graph, which this matches directly.

§Errors

  • IgraphError::InvalidArgument if beta is not a finite positive number, if the points are zero-dimensional (with at least one point), or if the rows have inconsistent dimensionality.
  • IgraphError::Unsupported if beta < 1 and the points are not 2-dimensional (the perpendicular-centre construction is only defined in 2D, matching the reference’s IGRAPH_UNIMPLEMENTED).

§Examples

use rust_igraph::lune_beta_skeleton;

// Four corners of a unit square. At β = 1 (the Gabriel graph) the four
// sides survive and both diagonals drop: each diagonal's midpoint has the
// two opposite corners sitting on the diametral circle.
let pts = vec![
    vec![0.0, 0.0],
    vec![1.0, 0.0],
    vec![0.0, 1.0],
    vec![1.0, 1.0],
];
let g = lune_beta_skeleton(&pts, 1.0).unwrap();
assert_eq!(g.vcount(), 4);
assert_eq!(g.ecount(), 4); // sides only