INNER CODE UNIT · C++
offset_table_
epsilla-cloud/vectordb · engine/db/ann_graph_segment.cpp:63
offset_table_ = new int64_t[record_number_ + 1];
neighbor_list_ = new int64_t[record_number_];
// Read the offset array
file.read(reinterpret_cast<char*>(offset_table_), sizeof(int64_t) * (record_number_ + 1));
// Get the total number of edges from the last element of offset_table_
int64_t total_edges = offset_table_[record_number_];
// Allocate memory for the neighbor list array with the correct size
neighbor_list_ = new int64_t[total_edges];
// Read the neighbor list array
file.read(reinterpret_cast<char*>(neighbor_list_), sizeof(int64_t) * total_edges);
// Read the nagivation point
file.read(reinterpret_cast<char*>(&navigation_point_), sizeof(navigation_point_));