Skip to content

Kulikov Maksimilian #35

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

MoxDevl
Copy link

@MoxDevl MoxDevl commented Jan 16, 2025

Куликов Максимилиан
Б03-312

Copy link

@github-actions github-actions bot left a 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

@@ -0,0 +1,8 @@
#include "dijkstra.hpp"

Choose a reason for hiding this comment

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

warning: 'dijkstra.hpp' file not found [clang-diagnostic-error]

#include "dijkstra.hpp"
         ^

Copy link

@github-actions github-actions bot left a 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

Copy link

@github-actions github-actions bot left a 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

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {

Copy link
Contributor

@LostPointer LostPointer left a comment

Choose a reason for hiding this comment

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

нет тестов, и задач, и код стайл не тот(
и форматирование не то(

Copy link
Contributor

Choose a reason for hiding this comment

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

не экономь на именах

@@ -0,0 +1,33 @@
#include "topo.hpp"

void topo_recr(EdgeOrientedGraph& graph, std::stack<int>& vstack, std::vector<int>& vcolor, int current) {
Copy link
Contributor

Choose a reason for hiding this comment

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

не по код стайлу(

Copy link

@github-actions github-actions bot left a 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 18. Check the log or trigger a new build to see more.

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^

TEST(Dijkstra, Simple) {
std::vector<double> expected = {0., 7., 9., 20., 20., 11.};

double inf = std::numeric_limits<double>::infinity();

Choose a reason for hiding this comment

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

warning: variable 'inf' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double inf = std::numeric_limits<double>::infinity();
double const inf = std::numeric_limits<double>::infinity();

#include <cmath>

template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {

Choose a reason for hiding this comment

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

warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
                                                                  ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
TEST(RMQ, Simple) {
double expected = 2;

Choose a reason for hiding this comment

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

warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double expected = 2;
double const expected = 2;

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));


TEST(TopologySort, Simple) {
TEST(RMQ, Simple) {
// double expected = 2;

Choose a reason for hiding this comment

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

warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
// double expected = 2;
double const expected = 2;

TEST(RMQ, Simple) {
// double expected = 2;
// // 0 1 2 3 4 5 6 7 8 9
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};

Choose a reason for hiding this comment

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

warning: variable 'vals' of type 'std::vector' can be declared 'const' [misc-const-correctness]

Suggested change
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};
std::vector<double> const vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};

// double expected = 2;
// // 0 1 2 3 4 5 6 7 8 9
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};
// std::vector<std::vector<double>> result = sparse_table(vals,

Choose a reason for hiding this comment

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

warning: variable 'result' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]

Suggested change
// std::vector<std::vector<double>> result = sparse_table(vals,
std::vector<std::vector<double>> const result = sparse_table(vals,

// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};
// std::vector<std::vector<double>> result = sparse_table(vals,
// std::less<double>());
// double num = rmq(1, 6, res, std::less<double>());

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'res' [clang-diagnostic-error]

  double num = rmq(1, 6, res, std::less<double>());
                         ^

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));


TEST(TopologySort, Simple) {
TEST(RMQ, Simple) {
// double expected = 2;

Choose a reason for hiding this comment

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

warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
// double expected = 2;
double const expected = 2;

TEST(RMQ, Simple) {
// double expected = 2;
// // 0 1 2 3 4 5 6 7 8 9
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};

Choose a reason for hiding this comment

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

warning: variable 'vals' of type 'std::vector' can be declared 'const' [misc-const-correctness]

Suggested change
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};
std::vector<double> const vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};

// double expected = 2;
// // 0 1 2 3 4 5 6 7 8 9
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};
// std::vector<std::vector<double>> result = sparse_table(vals,

Choose a reason for hiding this comment

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

warning: variable 'result' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]

Suggested change
// std::vector<std::vector<double>> result = sparse_table(vals,
std::vector<std::vector<double>> const result = sparse_table(vals,

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));


TEST(TopologySort, Simple) {
TEST(RMQ, Simple) {
// double expected = 2;

Choose a reason for hiding this comment

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

warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
// double expected = 2;
double const expected = 2;

TEST(RMQ, Simple) {
// double expected = 2;
// // 0 1 2 3 4 5 6 7 8 9
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};

Choose a reason for hiding this comment

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

warning: variable 'vals' of type 'std::vector' can be declared 'const' [misc-const-correctness]

Suggested change
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};
std::vector<double> const vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};

// double expected = 2;
// // 0 1 2 3 4 5 6 7 8 9
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1};
// std::vector<std::vector<double>> result = sparse_table(vals,

Choose a reason for hiding this comment

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

warning: variable 'result' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]

Suggested change
// std::vector<std::vector<double>> result = sparse_table(vals,
std::vector<std::vector<double>> const result = sparse_table(vals,

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key)
{
double infinity = std::numeric_limits<double>::infinity();

Choose a reason for hiding this comment

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

warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double infinity = std::numeric_limits<double>::infinity();
double const infinity = std::numeric_limits<double>::infinity();

#include <cmath>

template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {

Choose a reason for hiding this comment

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

warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
                                                                  ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key)
{
double infinity = std::numeric_limits<double>::infinity();

Choose a reason for hiding this comment

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

warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double infinity = std::numeric_limits<double>::infinity();
double const infinity = std::numeric_limits<double>::infinity();

#include <cmath>

template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {

Choose a reason for hiding this comment

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

warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
                                                                  ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key)
{
double infinity = std::numeric_limits<double>::infinity();

Choose a reason for hiding this comment

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

warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double infinity = std::numeric_limits<double>::infinity();
double const infinity = std::numeric_limits<double>::infinity();

#include <cmath>

template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {

Choose a reason for hiding this comment

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

warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
                                                                  ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key)
{
double infinity = std::numeric_limits<double>::infinity();

Choose a reason for hiding this comment

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

warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double infinity = std::numeric_limits<double>::infinity();
double const infinity = std::numeric_limits<double>::infinity();

#include <cmath>

template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {

Choose a reason for hiding this comment

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

warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
                                                                  ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));

Copy link

@github-actions github-actions bot left a 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

@@ -1 +1,45 @@
#include "util.hpp"

EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {

Choose a reason for hiding this comment

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

warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/util.hpp:12:

-     EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+     EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
Suggested change
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) {
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) {


EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {}

int EdgeOrientedGraph::size() { return _ways.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int EdgeOrientedGraph::size() { return _ways.size(); }
                                       ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    int V = weights.size();
            ^

}

OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) {
int V = weights.size();

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]

Suggested change
int V = weights.size();
int const V = weights.size();

x.pop_back();
}

int OrientedWeightedGraph::size() { return _weights.size(); }

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

int OrientedWeightedGraph::size() { return _weights.size(); }
                                           ^


std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key)
{
double infinity = std::numeric_limits<double>::infinity();

Choose a reason for hiding this comment

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

warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double infinity = std::numeric_limits<double>::infinity();
double const infinity = std::numeric_limits<double>::infinity();

#include <cmath>

template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {

Choose a reason for hiding this comment

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

warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
                                                                  ^


template<class Comparator>
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
int K = static_cast<int>(std::log2(vals.size()))+1;

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(vals.size()))+1;
int const K = static_cast<int>(std::log2(vals.size()))+1;


template<class Comparator>
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) {
int K = static_cast<int>(std::log2(finish - start + 1));

Choose a reason for hiding this comment

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

warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int K = static_cast<int>(std::log2(finish - start + 1));
int const K = static_cast<int>(std::log2(finish - start + 1));

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