MCPcopy Create free account
hub / github.com/antgroup/vsag / Init

Method Init

src/algorithm/pyramid.cpp:166–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 }
165}
166void
167IndexNode::Init() {
168 if (status_ == Status::NO_INDEX) {
169 if (ids_.size() >= index_min_size_) {
170 if (not ids_.empty() and level_ != 0) {
171 auto new_max_degree = get_suitable_max_degree(static_cast<int64_t>(ids_.size()));
172 if (new_max_degree < graph_param_->max_degree_) {
173 auto new_graph_param = std::make_shared<SparseGraphDatacellParameter>();
174 new_graph_param->FromJson(graph_param_->ToJson());
175 new_graph_param->max_degree_ =
176 get_suitable_max_degree(static_cast<int64_t>(ids_.size()));
177 graph_param_ = new_graph_param;
178 }
179 }
180 graph_ = std::make_shared<SparseGraphDataCell>(
181 std::dynamic_pointer_cast<SparseGraphDatacellParameter>(graph_param_), allocator_);
182 status_ = Status::GRAPH;
183 } else {
184 status_ = Status::FLAT;
185 }
186 }
187}
188
189void
190IndexNode::Search(const SearchFunc& search_func,

Callers 4

SearchWithRequestMethod · 0.45
SearchWithRequestMethod · 0.45
SearchWithRequestMethod · 0.45
add_one_pointMethod · 0.45

Calls 5

get_suitable_max_degreeFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45
FromJsonMethod · 0.45
ToJsonMethod · 0.45

Tested by

no test coverage detected