Skip to main content

circle_beta_skeleton

Function circle_beta_skeleton 

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

Build the circle-based β-skeleton of a 2-D point set.

points holds one row per point and must be 2-dimensional (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²) candidate enumeration with an O(n) empty-region 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

§Examples

use rust_igraph::circle_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 = circle_beta_skeleton(&pts, 1.0).unwrap();
assert_eq!(g.vcount(), 4);
assert_eq!(g.ecount(), 4); // sides only