Skip to content

Shatunov Evgeniy - #3

Open
ShatunovEvgeniy wants to merge 35 commits into
DafeMipt213:mainfrom
ShatunovEvgeniy:main
Open

Shatunov Evgeniy#3
ShatunovEvgeniy wants to merge 35 commits into
DafeMipt213:mainfrom
ShatunovEvgeniy:main

Conversation

@ShatunovEvgeniy

Copy link
Copy Markdown

Add own additional task with translation in different graph views

Comment thread additional_tasks/graph_view/src/container_couts.hpp Outdated
Comment thread additional_tasks/graph_view/src/graph_view.hpp Outdated
Comment thread additional_tasks/graph_view/src/graph_view.hpp Outdated
@LostPointer

Copy link
Copy Markdown
Contributor

скудные тесты, и форматирование.... по этому 4 из 6

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 71. Check the log or trigger a new build to see more.

data_.resize(vec_list.size(), std::vector<bool>(vec_list.size()));
for (size_t vec_index = 0; vec_index < vec_list.size(); vec_index++)
for (size_t index = 0; index < vec_list[vec_index].size(); index++)
data_[vec_index][vec_list[vec_index][index]] = vec_list[vec_index][index] || vec_list[vec_index][index] == 0 ? true : false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: logical expression is always true [misc-redundant-expression]

            data_[vec_index][vec_list[vec_index][index]] = vec_list[vec_index][index] || vec_list[vec_index][index] == 0 ? true : false;
                                                                                      ^

data_.clear();
data_.resize(unord_list.size(), std::vector<bool>(unord_list.size()));
for (size_t vec_index = 0; vec_index < unord_list.size(); vec_index++)
for (size_t elem : unord_list[vec_index])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: variable 'elem' of type 'size_t' (aka 'unsigned long') can be declared 'const' [misc-const-correctness]

Suggested change
for (size_t elem : unord_list[vec_index])
for (size_t const elem : unord_list[vec_index])

data_.resize(unord_list.size(), std::vector<bool>(unord_list.size()));
for (size_t vec_index = 0; vec_index < unord_list.size(); vec_index++)
for (size_t elem : unord_list[vec_index])
data_[vec_index][elem] = elem || elem == 0 ? true : false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: logical expression is always true [misc-redundant-expression]

            data_[vec_index][elem] = elem || elem == 0 ? true : false;
                                          ^

size_t max_vertex{0};
for (size_t index = 0; index < edge_list.size(); index++)
{
std::pair<size_t, size_t> pair = edge_list[index];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: variable 'pair' of type 'std::pair<size_t, size_t>' (aka 'pair<unsigned long, unsigned long>') can be declared 'const' [misc-const-correctness]

Suggested change
std::pair<size_t, size_t> pair = edge_list[index];
std::pair<size_t, size_t> const pair = edge_list[index];

for (size_t index = 0; index < edge_list.size(); index++)
{
std::pair<size_t, size_t> pair = edge_list[index];
size_t parent = pair.first;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: variable 'parent' of type 'size_t' (aka 'unsigned long') can be declared 'const' [misc-const-correctness]

Suggested change
size_t parent = pair.first;
size_t const parent = pair.first;

const std::vector<std::vector<bool>>::iterator end() { return data_.end(); }

std::vector<std::vector<bool>> GetMatrix() const { return data_; }
void LoadMatrix(const std::vector<std::vector<bool>> new_data) { data_ = new_data; };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: the const qualified parameter 'new_data' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

Suggested change
void LoadMatrix(const std::vector<std::vector<bool>> new_data) { data_ = new_data; };
void LoadMatrix(const std::vector<std::vector<bool>>& new_data) { data_ = new_data; };

std::vector<std::vector<size_t>> data_;
public:
AdjacencyListVec(const size_t size) : data_(size) {}
AdjacencyListVec(const std::vector<std::vector<size_t>> data) : data_{data} {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: the const qualified parameter 'data' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

Suggested change
AdjacencyListVec(const std::vector<std::vector<size_t>> data) : data_{data} {}
AdjacencyListVec(const std::vector<std::vector<size_t>>& data) : data_{data} {}

const std::vector<std::vector<size_t>>::iterator end() { return data_.end(); }

std::vector<std::vector<size_t>> GetList() const { return data_; }
void LoadList(const std::vector<std::vector<size_t>> new_data) { data_ = new_data; };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: the const qualified parameter 'new_data' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

Suggested change
void LoadList(const std::vector<std::vector<size_t>> new_data) { data_ = new_data; };
void LoadList(const std::vector<std::vector<size_t>>& new_data) { data_ = new_data; };

std::vector<std::unordered_set<size_t>> data_;
public:
AdjacencyListUnorderedSet(const size_t size) : data_(size) {}
AdjacencyListUnorderedSet(const std::vector<std::unordered_set<size_t>> data) : data_{data} {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: the const qualified parameter 'data' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

Suggested change
AdjacencyListUnorderedSet(const std::vector<std::unordered_set<size_t>> data) : data_{data} {}
AdjacencyListUnorderedSet(const std::vector<std::unordered_set<size_t>>& data) : data_{data} {}

friend std::ostream& operator<< (std::ostream &ost, AdjacencyListUnorderedSet& list_unord_set);
bool operator() (const size_t parent, const size_t child){
const std::unordered_set<size_t>& unord_set = data_[parent];
return std::find(unord_set.begin(), unord_set.end(), child) != unord_set.end();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: this STL algorithm call should be replaced with a container method [performance-inefficient-algorithm]

Suggested change
return std::find(unord_set.begin(), unord_set.end(), child) != unord_set.end();
return unord_set.find(child) != unord_set.end();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants