fix: clang-format for dijkstra (#1055)

This commit is contained in:
Filip Hlasek 2020-08-27 07:29:22 -07:00 committed by GitHub
parent 79fb528dad
commit eee5f9495d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,10 +26,10 @@
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
#include <memory>
#include <queue> #include <queue>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <memory>
constexpr int64_t INF = std::numeric_limits<int64_t>::max(); constexpr int64_t INF = std::numeric_limits<int64_t>::max();
@ -39,19 +39,19 @@ constexpr int64_t INF = std::numeric_limits<int64_t>::max();
*/ */
namespace graph { namespace graph {
/** /**
* @brief Function that add edge between two nodes or vertices of graph * @brief Function that add edge between two nodes or vertices of graph
* *
* @param u any node or vertex of graph * @param u any node or vertex of graph
* @param v any node or vertex of graph * @param v any node or vertex of graph
*/ */
void addEdge(std::vector<std::vector<std::pair<int, int>>> *adj, int u, int v, void addEdge(std::vector<std::vector<std::pair<int, int>>> *adj, int u, int v,
int w) { int w) {
(*adj)[u - 1].push_back(std::make_pair(v - 1, w)); (*adj)[u - 1].push_back(std::make_pair(v - 1, w));
// (*adj)[v - 1].push_back(std::make_pair(u - 1, w)); // (*adj)[v - 1].push_back(std::make_pair(u - 1, w));
} }
/** /**
* @brief Function runs the dijkstra algorithm for some source vertex and * @brief Function runs the dijkstra algorithm for some source vertex and
* target vertex in the graph and returns the shortest distance of target * target vertex in the graph and returns the shortest distance of target
* from the source. * from the source.
@ -63,7 +63,7 @@ namespace graph {
* @return shortest distance if target is reachable from source else -1 in * @return shortest distance if target is reachable from source else -1 in
* case if target is not reachable from source. * case if target is not reachable from source.
*/ */
int dijkstra(std::vector<std::vector<std::pair<int, int>>> *adj, int s, int t) { int dijkstra(std::vector<std::vector<std::pair<int, int>>> *adj, int s, int t) {
/// n denotes the number of vertices in graph /// n denotes the number of vertices in graph
int n = adj->size(); int n = adj->size();
@ -106,7 +106,7 @@ namespace graph {
return dist[t]; return dist[t];
} }
return -1; return -1;
} }
} // namespace graph } // namespace graph
/** Function to test the Algorithm */ /** Function to test the Algorithm */