HNSWIndex 1.1.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package HNSWIndex --version 1.1.3
NuGet\Install-Package HNSWIndex -Version 1.1.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HNSWIndex" Version="1.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HNSWIndex" Version="1.1.3" />
<PackageReference Include="HNSWIndex" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HNSWIndex --version 1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HNSWIndex, 1.1.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HNSWIndex@1.1.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HNSWIndex&version=1.1.3
#tool nuget:?package=HNSWIndex&version=1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HNSWIndex
HNSWIndex is a .NET library for constructing approximate nearest-neighbor (ANN) indices based on the Hierarchical Navigable Small World (HNSW) graph. This data structure provides efficient similarity searches for large, high-dimensional datasets.
Key Features
- High Performance: Implements the HNSW algorithm for fast approximate k-NN search.
- Flexible Distance Metric: Pass any
Func<TLabel, TLabel, TDistance>
for custom distance calculation. - Flexible Heuristic: Pass heuristic function for nodes linking.
- Concurrency Support: Thread safe graph building API
- Configurable Parameters: Fine-tune the indexing performance and memory trade-offs with parameters
Installation
Install via NuGet:
dotnet add package HNSWIndex
Or inside your .csproj:
<PackageReference Include="HNSWIndex" Version="x.x.x" />
Getting Started
1. Optionally configure parameters
var parameters = new HNSWParameters
{
RandomSeed = 123,
DistributionRate = 1.0,
MaxEdges = 16,
CollectionSize = 1024,
// ... other parameters
};
2. Create empty graph structure ()
var index = new HNSWIndex<float[], float>(Metrics.SquaredEuclideanMetric.Compute);
3. Build the graph
var vectors = RandomVectors();
foreach (var vector in vectors)
{
index.Add(vector)
}
Or multi-threaded
var vectors = RandomVectors();
Parallel.For(0, vectors.Count, i => {
index.Add(vectors[i]);
});
4. Query the structure
var k = 5;
var results = index.KnnQuery(queryPoint, k);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.5.0 | 130 | 8/21/2025 |
1.4.1 | 80 | 8/3/2025 |
1.4.0 | 145 | 7/15/2025 |
1.3.3 | 92 | 7/4/2025 |
1.3.2 | 196 | 6/18/2025 |
1.3.1 | 158 | 6/16/2025 |
1.3.0 | 312 | 6/10/2025 |
1.2.0 | 169 | 5/25/2025 |
1.1.5 | 172 | 4/18/2025 |
1.1.4 | 129 | 2/12/2025 |
1.1.3 | 136 | 2/11/2025 |
1.1.2 | 123 | 2/8/2025 |
1.1.1 | 136 | 2/6/2025 |
1.1.0 | 125 | 2/3/2025 |
1.0.2 | 117 | 1/22/2025 |
1.0.1 | 123 | 1/7/2025 |
1.0.0 | 132 | 1/6/2025 |