-
Notifications
You must be signed in to change notification settings - Fork 80
feat(HGraph): support use tau-mng #1338
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -104,6 +104,10 @@ HGraphParameter::FromJson(const JsonType& json) { | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (json.Contains(ALPHA_KEY)) { | ||||||||||||||||||||||||||||||||||||||
| this->alpha = json[ALPHA_KEY].GetFloat(); | ||||||||||||||||||||||||||||||||||||||
| this->selectedgeparam = "alpha"; | ||||||||||||||||||||||||||||||||||||||
| } else if (json.Contains(TAU_KEY)) { | ||||||||||||||||||||||||||||||||||||||
| this->tau = json[TAU_KEY].GetFloat(); | ||||||||||||||||||||||||||||||||||||||
| this->selectedgeparam = "tau"; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
105
to
111
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current logic gives precedence to
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (json.Contains(BUILD_THREAD_COUNT_KEY)) { | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -136,6 +140,7 @@ HGraphParameter::ToJson() const { | |||||||||||||||||||||||||||||||||||||
| json[GRAPH_KEY].SetJson(this->bottom_graph_param->ToJson()); | ||||||||||||||||||||||||||||||||||||||
| json[EF_CONSTRUCTION_KEY].SetInt(this->ef_construction); | ||||||||||||||||||||||||||||||||||||||
| json[ALPHA_KEY].SetFloat(this->alpha); | ||||||||||||||||||||||||||||||||||||||
| json[TAU_KEY].SetFloat(this->tau); | ||||||||||||||||||||||||||||||||||||||
| json[SUPPORT_DUPLICATE].SetBool(this->support_duplicate); | ||||||||||||||||||||||||||||||||||||||
| return json; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,14 @@ PyramidParameters::FromJson(const JsonType& json) { | |
|
|
||
| this->base_codes_param = CreateFlattenParam(json[BASE_CODES_KEY]); | ||
|
|
||
| if (json.Contains(ALPHA_KEY)) { | ||
| this->alpha = json[ALPHA_KEY].GetFloat(); | ||
| this->selectedgeparam = "alpha"; | ||
| } else if (json.Contains(TAU_KEY)) { | ||
| this->tau = json[TAU_KEY].GetFloat(); | ||
| this->selectedgeparam = "tau"; | ||
| } | ||
|
Comment on lines
+50
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to if (json.Contains(ALPHA_KEY) && json.Contains(TAU_KEY)) {
throw VsagException(ErrorType::INVALID_ARGUMENT, "alpha and tau are mutually exclusive, please provide only one.");
}
if (json.Contains(ALPHA_KEY)) {
this->alpha = json[ALPHA_KEY].GetFloat();
this->selectedgeparam = "alpha";
} else if (json.Contains(TAU_KEY)) {
this->tau = json[TAU_KEY].GetFloat();
this->selectedgeparam = "tau";
} |
||
|
|
||
| if (json.Contains(NO_BUILD_LEVELS)) { | ||
| const auto& no_build_levels_json = json[NO_BUILD_LEVELS]; | ||
| CHECK_ARGUMENT(no_build_levels_json.IsArray(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a copy-paste error in this block. The
mutually_connect_new_elementfunction is called withthis->bottom_graph_for bothalphaandtaustrategies inside the loop overroute_graphs_. It should be usingroute_graphs_[j]to connect the new element to the correct hierarchical level, as was done in the original code. This will cause incorrect graph construction for all but the bottom layer.Additionally, this block of code is almost identical to the one for
bottom_graph_above (lines 1034-1050). You could consider refactoring this logic into a helper function to avoid duplication and prevent such errors in the future.