pub struct CellIndex { /* private fields */ }Expand description
The index.
Implementations§
Source§impl CellIndex
impl CellIndex
Sourcepub fn new(w: f64, arc: f64) -> Self
pub fn new(w: f64, arc: f64) -> Self
Build an index with band width w and target sector arc arc, both in
hyperbolic units. Measured on 5 461 nodes: 0.5 / 0.5 gives 1 184 cells
with a largest cell of 43 (the fixed buckets gave 26 cells and 1 462).
Both are stored so cells stay reproducible.
Sourcepub fn parameters(&self) -> (f64, f64)
pub fn parameters(&self) -> (f64, f64)
Band width and target arc this index was built with.
Sourcepub fn cell_count(&self) -> usize
pub fn cell_count(&self) -> usize
Number of materialised cells — occupancy diagnostics.
Sourcepub fn cell_of(&self, point: &HyperbolicPoint) -> CellId
pub fn cell_of(&self, point: &HyperbolicPoint) -> CellId
The cell a point belongs to. Comparisons and one division; no transcendental.
Sourcepub fn insert(&self, unique_id: &str, point: &HyperbolicPoint)
pub fn insert(&self, unique_id: &str, point: &HyperbolicPoint)
Register a node. Re-registering an id moves it to its new cell.
Sourcepub fn knn(
&self,
query: &HyperbolicPoint,
k: usize,
) -> Vec<(String, FixedPoint)>
pub fn knn( &self, query: &HyperbolicPoint, k: usize, ) -> Vec<(String, FixedPoint)>
The k nearest nodes to query, ascending by (distance, unique_id).
Sourcepub fn within_radius(
&self,
centre: &HyperbolicPoint,
radius: FixedPoint,
) -> Vec<(String, FixedPoint)>
pub fn within_radius( &self, centre: &HyperbolicPoint, radius: FixedPoint, ) -> Vec<(String, FixedPoint)>
Every node within radius (hyperbolic) of centre.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CellIndex
impl Freeze for CellIndex
impl Send for CellIndex
impl Sync for CellIndex
impl Unpin for CellIndex
impl UnsafeUnpin for CellIndex
impl UnwindSafe for CellIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more