MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / neighbors_at

Method neighbors_at

nodedb-vector/src/codec_index/graph.rs:123–130  ·  view source on GitHub ↗

Return the neighbor slice for `idx` at `layer`.

(&self, idx: u32, layer: usize)

Source from the content-addressed store, hash-verified

121
122 /// Return the neighbor slice for `idx` at `layer`.
123 pub fn neighbors_at(&self, idx: u32, layer: usize) -> &[u32] {
124 let node = &self.nodes[idx as usize];
125 if layer < node.neighbors.len() {
126 &node.neighbors[layer]
127 } else {
128 &[]
129 }
130 }
131
132 /// Max neighbors allowed at `layer`.
133 pub(crate) fn max_neighbors(&self, layer: usize) -> usize {

Callers 4

greedy_nearestMethod · 0.45
search_layer_buildMethod · 0.45
greedy_nearest_searchMethod · 0.45
search_layer_0Method · 0.45

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected