Skip to content

Commit

Permalink
check for dupe path names in validate
Browse files Browse the repository at this point in the history
  • Loading branch information
glennhickey committed Sep 6, 2023
1 parent 647d935 commit 19a29a4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/subcommand/validate_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,15 @@ int main_validate(int argc, char** argv) {
}
});

unordered_set<string> path_names;
graph->for_each_path_handle([&](path_handle_t path_handle) {
string path_name = graph->get_path_name(path_handle);
if (path_names.count(path_name)) {
cerr << "graph invalid: duplicate path name, " << path_name <<", detected" << endl;
valid_graph = false;
} else {
path_names.insert(path_name);
}
size_t i = 0;
handle_t prev;
graph->for_each_step_in_path(path_handle, [&](step_handle_t step_handle) {
Expand All @@ -151,14 +159,14 @@ int main_validate(int argc, char** argv) {
cerr << "graph invalid: missing edge between " << (i-1) << "th step ("
<< graph->get_id(prev) << ":" << graph->get_is_reverse(prev) << ") and "
<< i << "th step (" << graph->get_id(handle) << ":" << graph->get_is_reverse(handle)
<< ") of path " << graph->get_path_name(path_handle) << endl;
<< ") of path " << path_name << endl;
valid_graph = false;
}
if (!graph->has_edge(graph->flip(handle), graph->flip(prev))) {
cerr << "graph invalid: missing edge between " << (i) << "th step ("
<< graph->get_id(handle) << ":" << !graph->get_is_reverse(handle) << ") and "
<< (i-1) << "th step (" << graph->get_id(prev) << ":" << graph->get_is_reverse(prev)
<< ") of path " << graph->get_path_name(path_handle) << endl;
<< ") of path " << path_name << endl;
valid_graph = false;
}
}
Expand Down

1 comment on commit 19a29a4

@adamnovak
Copy link
Member

Choose a reason for hiding this comment

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

vg CI tests complete for branch deconstruct. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 18308 seconds

Please sign in to comment.