pub struct VGraph { /* private fields */ }Implementations§
Source§impl VGraph
impl VGraph
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Writes the index for VGraph::open: to a temporary file next to path, synced, then
renamed over it, so a reader never sees a partial file. Little-endian targets only (the
arrays are written as they lie in memory).
Sourcepub fn open(path: &Path, residency: Residency) -> Result<Self>
pub fn open(path: &Path, residency: Residency) -> Result<Self>
Opens an index written by VGraph::save with its arrays where residency puts them.
The search reads the arrays in place, so its results are those of the saved index.
A mapped index (the default, prefaulted) must not be modified or truncated while it is
open: the mapping would change under the index, and a truncated page faults with
SIGBUS. Replace the file by renaming a new one over it, as VGraph::save does.
Source§impl VGraph
impl VGraph
Sourcepub fn from_graph(g: &Graph, residual: bool) -> Result<Self, HmsError>
pub fn from_graph(g: &Graph, residual: bool) -> Result<Self, HmsError>
Encodes a built graph with the 8-bit residual code used by rerank (or none), unaligned
rows and the build’s vertex order.
Sourcepub fn from_graph_with(
g: &Graph,
bits: u8,
residual_bits: u8,
align: bool,
reorder: bool,
id_bytes: u8,
screen: bool,
) -> Result<Self, HmsError>
pub fn from_graph_with( g: &Graph, bits: u8, residual_bits: u8, align: bool, reorder: bool, id_bytes: u8, screen: bool, ) -> Result<Self, HmsError>
Encodes a built graph. bits (8 or 4) sizes the traversal code and residual_bits
(0, 4 or 8) the re-rank code of its residual; align keeps every code row inside as
few 128-byte lines as its size allows; reorder renumbers the vertices in breadth-first
order (search still returns the original ids); id_bytes 3 stores neighbour ids in
three bytes (graphs below 2^24 - 1 vertices) instead of 4, and 0 stores each list
sorted and delta-coded as varints (sizes vary; reorder makes the deltas small); screen adds a 1-bit
sign code of the rotated centred vector per vertex (RaBitQ-style, with a per-vertex
factor) that the search consults before paying for the 8-bit estimate.
Sourcepub fn with_blocks(self, g: &Graph, bits: u8) -> Result<Self, HmsError>
pub fn with_blocks(self, g: &Graph, bits: u8) -> Result<Self, HmsError>
Adds neighbour-block codes: every vertex stores, next to its neighbour list, a
bits-per-coordinate code of each neighbour’s rotated centred vector in the fast-scan
layout (32 codes per block), so one streamed read and one table scan estimate all
neighbours of an expanded vertex instead of one random row fetch per neighbour
(SymphonyQG’s layout; Gou et al., SIGMOD 2025). bits is 1, 2 or 4.
Sourcepub fn has_blocks(&self) -> bool
pub fn has_blocks(&self) -> bool
True if the index carries neighbour-block codes.
Sourcepub fn block_bytes(&self) -> usize
pub fn block_bytes(&self) -> usize
Bytes of the neighbour-block codes and scales.
Sourcepub fn has_screen(&self) -> bool
pub fn has_screen(&self) -> bool
True if the index carries the 1-bit screen.
Sourcepub fn screen_bytes(&self) -> usize
pub fn screen_bytes(&self) -> usize
Bytes of the screen rows.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn has_residual(&self) -> bool
Sourcepub fn index_bytes(&self) -> usize
pub fn index_bytes(&self) -> usize
Bytes held by the index, residual and id map included.
Sourcepub fn residual_bytes(&self) -> usize
pub fn residual_bytes(&self) -> usize
Bytes of the residual codes and their scales, which only rerank reads.
Sourcepub fn searcher(&self) -> VSearcher<'_>
pub fn searcher(&self) -> VSearcher<'_>
A searcher with the knobs of the environment (SearchKnobs::from_env).
Sourcepub fn searcher_with(&self, knobs: SearchKnobs) -> VSearcher<'_>
pub fn searcher_with(&self, knobs: SearchKnobs) -> VSearcher<'_>
A searcher with explicit SearchKnobs.
Auto Trait Implementations§
impl Freeze for VGraph
impl RefUnwindSafe for VGraph
impl Send for VGraph
impl Sync for VGraph
impl Unpin for VGraph
impl UnsafeUnpin for VGraph
impl UnwindSafe for VGraph
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.