pub fn gabriel_graph(points: &[Vec<f64>]) -> IgraphResult<Graph>Expand description
Build the Gabriel graph of a point set.
points holds one row per point with a shared, arbitrary
dimensionality (inferred from the first row). The result is an
undirected Graph on points.len() vertices whose edges are exactly
the Gabriel-adjacent pairs.
This is an O(n²·d) candidate enumeration with an O(n·d) empty-ball
test per pair (O(n³·d) overall), which reproduces the reference
filter exactly: the Gabriel graph is a subgraph of the Delaunay
triangulation, so testing every pair yields the same edge set as the
reference’s Delaunay-pruned candidate superset.
§Errors
IgraphError::InvalidArgumentif the points are zero-dimensional (and there is at least one point).IgraphError::InvalidArgumentif the rows have inconsistent dimensionality.
§Examples
use rust_igraph::gabriel_graph;
// The four corners of a unit square: the Gabriel graph keeps the four
// sides and drops both diagonals (each diagonal's midpoint has the two
// opposite corners sitting on the diametral circle).
let pts = vec![
vec![0.0, 0.0], // 0
vec![1.0, 0.0], // 1
vec![0.0, 1.0], // 2
vec![1.0, 1.0], // 3
];
let g = gabriel_graph(&pts).unwrap();
assert_eq!(g.vcount(), 4);
assert_eq!(g.ecount(), 4); // sides only, no diagonals