| 164 | } |
| 165 | } |
| 166 | void |
| 167 | IndexNode::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 | |
| 189 | void |
| 190 | IndexNode::Search(const SearchFunc& search_func, |
no test coverage detected