Skip to main content

VGraph

Struct VGraph 

Source
pub struct VGraph { /* private fields */ }

Implementations§

Source§

impl VGraph

Source

pub fn dim(&self) -> usize

Dimension of the indexed vectors.

Source

pub fn metric(&self) -> Metric

The metric the index orders by.

Source

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).

Source

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

Source

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.

Source

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.

Source

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.

Source

pub fn has_blocks(&self) -> bool

True if the index carries neighbour-block codes.

Source

pub fn block_bytes(&self) -> usize

Bytes of the neighbour-block codes and scales.

Source

pub fn has_screen(&self) -> bool

True if the index carries the 1-bit screen.

Source

pub fn screen_bytes(&self) -> usize

Bytes of the screen rows.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn has_residual(&self) -> bool

Source

pub fn index_bytes(&self) -> usize

Bytes held by the index, residual and id map included.

Source

pub fn residual_bytes(&self) -> usize

Bytes of the residual codes and their scales, which only rerank reads.

Source

pub fn searcher(&self) -> VSearcher<'_>

A searcher with the knobs of the environment (SearchKnobs::from_env).

Source

pub fn searcher_with(&self, knobs: SearchKnobs) -> VSearcher<'_>

A searcher with explicit SearchKnobs.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more