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 <iostream>
#include <limits>
#include <memory>
#include <queue>
#include <utility>
#include <vector>
#include <memory>
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 {
/**
/**
* @brief Function that add edge between two nodes or vertices of graph
*
* @param u 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) {
(*adj)[u - 1].push_back(std::make_pair(v - 1, w));
// (*adj)[v - 1].push_back(std::make_pair(u - 1, w));
}
}
/**
/**
* @brief Function runs the dijkstra algorithm for some source vertex and
* target vertex in the graph and returns the shortest distance of target
* from the source.
@ -63,7 +63,7 @@ namespace graph {
* @return shortest distance if target is reachable from source else -1 in
* 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
int n = adj->size();
@ -106,7 +106,7 @@ namespace graph {
return dist[t];
}
return -1;
}
}
} // namespace graph
/** Function to test the Algorithm */