All internal functions

HNSW.LayeredGraphMethod
LayeredGraph{T}(num_elements, M, M0, m_L)

A multi-layer directed graph with num_elements nodes and edges of type T. The bottom layer contains all points and each upper layer contains a subset of nodes of the one below. M0 is the maximum number of edges in the bottom layer. M is the maximum number of edges in all other layers.

m_L is used for random level generation. ( See 'getrandomlevel' )

source
HNSW.NeighborType
Neighbor{T, F}(idx::T, dist::F)

Simple struct for storing a neighbor index along with its distance to some query element.

source
HNSW.NeighborSetType
NeighborSet(n::Neighbor)

An ordered List of 'Neighbor', sorted by the dist field. Elements can be added by calling

insert!(ns::NeighborsSet, n::Neighbor)

and retrieved with

nearest(ns::NeighborSet) → Neighbor
nearest(ns::NeighborSet, k) → k nearest Neighbors
furthest(ns::NeighborSet) → Neighbor
pop_nearest!(ns::NeighborSet) → Neighbor
pop_furthest!(ns::NeighborSet) → Neighbor
source
HNSW.VisitedListMethod
VisitedList(num_elements)

List with num_elements entries to keep track of wether they have been visited or not. Check status with isvisited(vl::VisitedList, idx) → Bool

and visit with visit!(vl::VisitedList, idx)

To reset the list, call 'reset!(vl)'.

source
HNSW.VisitedListPoolMethod
VisitedListPool(num_lists, num_elements)

A thread-stable container for multiple VisitedLists initialized with num_lists lists with each num_elements entries.

To retrieve a list, call get_list(vlp::VisitedListPool), and to release ist, call release_list(vlp, vl::VisitedList).

source
HNSW.add_to_graph!Method
add_to_graph!(notify_func, hnsw, indices, multithreading=false)

Add i ∈ indices referring to data[i] into the graph.

notify_func(i) provides an interface for a progress notification by current index.

Indices already added previously will be ignored.

source
HNSW.insert_point!Function
insert_point!(hnsw, q, l = get_random_level(hnsw.lgraph))

Insert index query referring to data point data[q] into the graph.

source
HNSW.neighborsMethod
neighbors(lg::LayeredGraph, level, q::Integer)

Return an Iterator over all links currently assigned.

source