support build graph from existing graph storage in ODescent#406
Conversation
| ODescent::Build(const uint32_t* valid_ids, | ||
| int64_t data_num, | ||
| const GraphInterfacePtr graph_storage) { | ||
| graph_.clear(); |
There was a problem hiding this comment.
support build multi-graph with one graph builder
| new_neighbors[i].reserve(max_degree_); | ||
| } | ||
| init_graph(); | ||
| init_graph(graph_storage); |
There was a problem hiding this comment.
init from existing graph_storage
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## main #406 +/- ##
==========================================
- Coverage 91.34% 91.31% -0.03%
==========================================
Files 144 144
Lines 9290 9317 +27
==========================================
+ Hits 8486 8508 +22
- Misses 804 809 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
| ODescent::init_graph(const GraphInterfacePtr graph_storage) { | ||
| graph_.resize(data_num_, Linklist(allocator_)); | ||
| UnorderedMap<uint32_t, uint32_t> inner_ids_to_locs(allocator_); | ||
| std::function<uint32_t(uint32_t)> id_map = nullptr; |
| uint32_t id = i; | ||
| if (data_num_ - 1 < max_degree_) { | ||
| id = (i + j + 1) % data_num_; | ||
| while (ids_set.find(id) != ids_set.end() && ids_set.size() <= max_neighbors) { |
There was a problem hiding this comment.
Here can optimize to:
if (ids_set.size() <= max_neighbors) {
while (ids_set.find(id) != ids_set.end()) {
// ....
}
}There was a problem hiding this comment.
I found that the check ids_set.size() <= max_neighbors is redundant, because valid_id_count < max_neighbors can actually guarantee that ids_set.size() <= max_neighbors. Therefore, I have removed the corresponding logic.
65f6ff6 to
ef0d883
Compare
0e358a3 to
04cada7
Compare
…#406) Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
…#406) Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com> Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
…#406) Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com> Signed-off-by: Sia Sheerland <x1075956441x@163.com> Signed-off-by: Sia Sheerland <x1075956441x@163.com>
No description provided.