mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
fix: clang-format for dijkstra (#1055)
This commit is contained in:
parent
79fb528dad
commit
eee5f9495d
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user