-
Notifications
You must be signed in to change notification settings - Fork 23
Graph class ~/lib/src #5
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?
Graph class ~/lib/src #5
Conversation
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.
clang-tidy made some suggestions
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.
clang-tidy made some suggestions
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.
clang-tidy made some suggestions
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.
clang-tidy made some suggestions
task_01/src/test.cpp
Outdated
TEST(Test, Simple) { | ||
ASSERT_EQ(1, 1); // Stack [] | ||
#include "../lib/src/graph.h" | ||
#include "./main.cpp" |
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.
warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]
#include "./main.cpp"
^
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.
clang-tidy made some suggestions
lib/src/graph.h
Outdated
@@ -0,0 +1,74 @@ | |||
#ifndef __GRAPH_H__ | |||
#define __GRAPH_H__ |
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.
warning: declaration uses identifier 'GRAPH_H', which is a reserved identifier [bugprone-reserved-identifier]
#define __GRAPH_H__ | |
#define GRAPH_H_ |
task_01/src/main.cpp
Outdated
st.push(start_name); | ||
|
||
while (!st.empty()) { | ||
int v = st.top(); |
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.
warning: variable 'v' of type 'int' can be declared 'const' [misc-const-correctness]
int v = st.top(); | |
int const v = st.top(); |
task_01/src/test.cpp
Outdated
bool found_parent; | ||
for (int i = 0; i < order.size(); ++i) { | ||
for (int j = i + 1; j < order.size(); ++j) { | ||
found_parent = false; |
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.
warning: Value stored to 'found_parent' is never read [clang-analyzer-deadcode.DeadStores]
found_parent = false;
^
Additional context
task_01/src/test.cpp:9: Value stored to 'found_parent' is never read
found_parent = false;
^
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.
clang-tidy made some suggestions
task_01/src/test.cpp
Outdated
TEST(Test, Simple) { | ||
ASSERT_EQ(1, 1); // Stack [] | ||
#include "../../lib/src/graph.h" | ||
#include "main.cpp" |
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.
warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]
#include "main.cpp"
^
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.
clang-tidy made some suggestions
task_01/src/test.cpp
Outdated
#include <stdexcept> | ||
|
||
#include "../../lib/src/graph.h" | ||
#include "main.cpp" |
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.
warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]
#include "main.cpp"
^
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.
clang-tidy made some suggestions
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 15 out of 16. Check the log or trigger a new build to see more.
|
||
try { | ||
topological_sort_dfs_rec(g); | ||
} catch (std::runtime_error) { |
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.
warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]
} catch (std::runtime_error) {
^
|
||
try { | ||
topological_sort_dfs_rec(g); | ||
} catch (std::runtime_error) { |
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.
warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]
} catch (std::runtime_error) {
^
task_04/src/test.cpp
Outdated
{{5, 4}, 9}, | ||
{{4, 5}, 9}, | ||
}); | ||
bool passed = (std::map<int, double>( |
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.
warning: variable 'passed' of type 'bool' can be declared 'const' [misc-const-correctness]
bool passed = (std::map<int, double>( | |
bool const passed = (std::map<int, double>( |
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.
clang-tidy made some suggestions
|
||
try { | ||
topological_sort_dfs_rec(g); | ||
} catch (std::runtime_error) { |
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.
warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]
} catch (std::runtime_error) {
^
|
||
try { | ||
topological_sort_dfs_rec(g); | ||
} catch (std::runtime_error) { |
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.
warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]
} catch (std::runtime_error) {
^
visited[v] = true; | ||
tin[v] = fup[v] = time++; | ||
for (size_t i = 0; i < g.adjacents[v].size(); ++i) { | ||
int to = g.adjacents[v][i].name; |
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.
warning: variable 'to' of type 'int' can be declared 'const' [misc-const-correctness]
int to = g.adjacents[v][i].name; | |
int const to = g.adjacents[v][i].name; |
} | ||
|
||
std::vector<std::pair<int, int>> get_bridges_taryan(Graph& g) { | ||
int time = 0; |
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.
warning: variable 'time' of type 'int' can be declared 'const' [misc-const-correctness]
int time = 0; | |
int const time = 0; |
} | ||
|
||
std::vector<int> get_cut_verts_taryan(Graph& g) { | ||
int time = 0; |
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.
warning: variable 'time' of type 'int' can be declared 'const' [misc-const-correctness]
int time = 0; | |
int const time = 0; |
#include <vector> | ||
|
||
class Graph { | ||
struct vert_neigh { |
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.
хотяб VertNeighbour
|
||
int size() const { return adjacents.size(); } | ||
|
||
void add_vert() { adjacents.push_back({}); } |
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.
имена методов не по кодстайлу
|
||
bool error_occured = false; | ||
|
||
try { |
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.
есть ASSERT_THROW и другие похожие макросы
|
||
try { | ||
topological_sort_dfs_rec(g); | ||
} catch (std::runtime_error) { |
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.
тут анализатор прав
|
||
#include "../../lib/src/graph.h" | ||
|
||
std::vector<int>* topological_sort_dfs_rec(Graph& g); |
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.
и тут будет утечка(
} | ||
} | ||
return dists; | ||
} |
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.
утечет то что хранится в top_order(((
Simple class performing the functions of a directed graph with path lengths and point names/