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

Function build_index

nodedb-vector/src/navix/traversal.rs:463–479  ·  view source on GitHub ↗
(n: usize)

Source from the content-addressed store, hash-verified

461 use crate::hnsw::{HnswIndex, HnswParams};
462
463 fn build_index(n: usize) -> HnswIndex {
464 let mut idx = HnswIndex::with_seed(
465 3,
466 HnswParams {
467 m: 8,
468 m0: 16,
469 ef_construction: 50,
470 metric: DistanceMetric::L2,
471 dtype: nodedb_types::vector_dtype::VectorStorageDtype::F32,
472 },
473 42,
474 );
475 for i in 0..n {
476 idx.insert(vec![i as f32, 0.0, 0.0]).unwrap();
477 }
478 idx
479 }
480
481 fn all_allowed(n: u32) -> RoaringBitmap {
482 let mut b = RoaringBitmap::new();

Calls 1

insertMethod · 0.45