Struct hnsw::Hnsw[][src]

pub struct Hnsw<Met, T, R, const M: usize, const M0: usize> { /* fields omitted */ }
Expand description

This provides a HNSW implementation for any distance function.

The type T must implement space::Metric to get implementations.

Implementations

Creates a new HNSW with a PRNG which is default seeded to produce deterministic behavior.

Creates a new HNSW with a default seeded PRNG and with the specified params.

Creates a HNSW with the passed prng.

Creates a HNSW with the passed params and prng.

Inserts a feature into the HNSW.

Does a k-NN search where q is the query element and it attempts to put up to M nearest neighbors into dest. ef is the candidate pool size. ef can be increased to get better recall at the expense of speed. If ef is less than dest.len() then dest will only be filled with ef elements.

Returns a slice of the filled neighbors.

Extract the feature for a given item returned by [HNSW::nearest].

The item must be retrieved from [HNSW::search_layer].

Extract the feature from a particular level for a given item returned by [HNSW::search_layer].

Retrieve the item ID for a given layer item returned by [HNSW::search_layer].

Performs the same algorithm as [HNSW::nearest], but stops on a particular layer of the network and returns the unique index on that layer rather than the item index.

If this is passed a level of 0, then this has the exact same functionality as [HNSW::nearest] since the unique indices at layer 0 are the item indices.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Get num nearest neighbors of target. Read more

Get the nearest neighbor of target. Read more

Get a point using a neighbor index returned by Knn::knn or Knn::nn. Read more

Get num nearest neighbor points of target. Read more

Get the nearest neighbor point of target. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.