Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce unnecessary conversions in sparse_graph_datacell #470

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/data_cell/sparse_graph_datacell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ SparseGraphDataCell::SparseGraphDataCell(Allocator* allocator, uint32_t max_degr

SparseGraphDataCell::SparseGraphDataCell(const GraphInterfaceParamPtr& param,
const IndexCommonParam& common_param)
: SparseGraphDataCell(
common_param.allocator_.get(),
std::dynamic_pointer_cast<GraphDataCellParameter>(param)->max_degree_ / 2) {
: SparseGraphDataCell(common_param.allocator_.get(),
std::dynamic_pointer_cast<GraphDataCellParameter>(param)->max_degree_) {
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/impl/odescent_graph_builder_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST_CASE("ODescent Build Test", "[ut][ODescent]") {
// prepare graph param
vsag::GraphDataCellParamPtr graph_param_ptr = std::make_shared<vsag::GraphDataCellParameter>();
graph_param_ptr->io_parameter_ = std::make_shared<vsag::MemoryIOParameter>();
graph_param_ptr->max_degree_ = partial_data ? 2 * max_degree : max_degree;
graph_param_ptr->max_degree_ = max_degree;
// build graph
auto odescent_param = std::make_shared<vsag::ODescentParameter>();
odescent_param->max_degree = max_degree;
Expand Down
4 changes: 0 additions & 4 deletions src/index/pyramid_zparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ PyramidParameters::FromJson(const JsonType& json) {
fmt::format("pyramid parameters must contains {}", GRAPH_TYPE_ODESCENT));
const auto& graph_json = json[GRAPH_TYPE_ODESCENT];
graph_param = GraphInterfaceParameter::GetGraphParameterByJson(graph_json);
// FIXME(inabao): This issue, where the edge length in the sparse graph defined in HGraph is half of the intended length, has been addressed here and will be revised in a subsequent PR.
std::dynamic_pointer_cast<GraphDataCellParameter>(graph_param)->max_degree_ *= 2;
odescent_param = std::make_shared<ODescentParameter>();
odescent_param->FromJson(graph_json);
this->flatten_data_cell_param = std::make_shared<FlattenDataCellParameter>();
Expand All @@ -48,8 +46,6 @@ JsonType
PyramidParameters::ToJson() {
JsonType json;
json[GRAPH_TYPE_ODESCENT] = graph_param->ToJson();
json[GRAPH_TYPE_ODESCENT][GRAPH_PARAM_MAX_DEGREE] =
std::dynamic_pointer_cast<GraphDataCellParameter>(graph_param)->max_degree_ / 2;
json[GRAPH_TYPE_ODESCENT].update(odescent_param->ToJson());
json[PYRAMID_PARAMETER_BASE_CODES] = flatten_data_cell_param->ToJson();
return json;
Expand Down