summaryrefslogtreecommitdiff
path: root/graph/dijkstra.cpp
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2023-08-29 00:09:28 +0200
committermzuenni <michi.zuendorf@gmail.com>2023-08-29 00:09:28 +0200
commit4905811a7c635f28827984a999aedacd910f4dc3 (patch)
treed21228d541bb14dc2dc29ffdff2331dfb5ba6b1e /graph/dijkstra.cpp
parentf209418070050d4310a19191e3cd771760e5b521 (diff)
consistency
Diffstat (limited to 'graph/dijkstra.cpp')
-rw-r--r--graph/dijkstra.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/graph/dijkstra.cpp b/graph/dijkstra.cpp
index 50c9654..aa938ec 100644
--- a/graph/dijkstra.cpp
+++ b/graph/dijkstra.cpp
@@ -1,16 +1,16 @@
using path = pair<ll, int>; //dist, destination
-void dijkstra(const vector<vector<path>> &adjlist, int start) {
+void dijkstra(const vector<vector<path>>& adj, int start) {
priority_queue<path, vector<path>, greater<path>> pq;
- vector<ll> dist(sz(adjlist), INF);
- vector<int> prev(sz(adjlist), -1);
+ vector<ll> dist(sz(adj), INF);
+ vector<int> prev(sz(adj), -1);
dist[start] = 0; pq.emplace(0, start);
while (!pq.empty()) {
auto [dc, c] = pq.top(); pq.pop();
if (dc > dist[c]) continue; // WICHTIG!
- for (auto [dx, x] : adjlist[c]) {
+ for (auto [dx, x] : adj[c]) {
ll newDist = dc + dx;
if (newDist < dist[x]) {
dist[x] = newDist;