Skip to content

support build graph from existing graph storage in ODescent#406

Merged
inabao merged 3 commits into
mainfrom
support-build-graph-from-exist-graph-storage
Feb 19, 2025
Merged

support build graph from existing graph storage in ODescent#406
inabao merged 3 commits into
mainfrom
support-build-graph-from-exist-graph-storage

Conversation

@inabao

@inabao inabao commented Feb 17, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

ODescent::Build(const uint32_t* valid_ids,
int64_t data_num,
const GraphInterfacePtr graph_storage) {
graph_.clear();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support build multi-graph with one graph builder

new_neighbors[i].reserve(max_degree_);
}
init_graph();
init_graph(graph_storage);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init from existing graph_storage

@inabao inabao self-assigned this Feb 17, 2025
@inabao inabao added the kind/improvement Optimizations, UX polish, or minor improvements 性能优化、体验打磨或细节改良 label Feb 17, 2025
@codecov

codecov Bot commented Feb 17, 2025

Copy link
Copy Markdown

Codecov Report

All 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     
Flag Coverage Δ
cpp 91.31% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
common 95.61% <ø> (ø)
datacell 91.39% <ø> (-0.65%) ⬇️
index 91.48% <ø> (+0.08%) ⬆️
simd 83.79% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b1ebaa...04cada7. Read the comment docs.

Comment thread src/impl/odescent_graph_builder.cpp Outdated
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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id_map -> id_map_func

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/impl/odescent_graph_builder.cpp
Comment thread src/impl/odescent_graph_builder.cpp Outdated
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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here can optimize to:

if (ids_set.size() <= max_neighbors) {
    while (ids_set.find(id) != ids_set.end()) {
        // ....
    }
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@inabao
inabao force-pushed the support-build-graph-from-exist-graph-storage branch from 65f6ff6 to ef0d883 Compare February 18, 2025 06:16

@jiaweizone jiaweizone left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
@inabao
inabao force-pushed the support-build-graph-from-exist-graph-storage branch from 0e358a3 to 04cada7 Compare February 19, 2025 02:34
@inabao
inabao merged commit 5a69b6e into main Feb 19, 2025
@inabao
inabao deleted the support-build-graph-from-exist-graph-storage branch February 19, 2025 03:32
jiacai2050 pushed a commit to jiacai2050/vsag that referenced this pull request Mar 6, 2025
…#406)

Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
LHT129 pushed a commit to LHT129/vsag that referenced this pull request Apr 16, 2026
…#406)

Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
LHT129 pushed a commit that referenced this pull request May 11, 2026
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
Sia-Sheerland pushed a commit to Sia-Sheerland/vsag that referenced this pull request Jun 26, 2026
…#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Optimizations, UX polish, or minor improvements 性能优化、体验打磨或细节改良 size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants